From f21d9e621093f4ff909e4124f05064e188f01ec8 Mon Sep 17 00:00:00 2001 From: maximthomas Date: Tue, 28 Feb 2023 16:24:30 +0300 Subject: [PATCH 1/2] Compact OpenIG docker images --- openig-docker/Dockerfile | 17 ++++++++--------- openig-docker/Dockerfile-alpine | 11 ++++------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/openig-docker/Dockerfile b/openig-docker/Dockerfile index cb8e9e0bf..d12eae04e 100644 --- a/openig-docker/Dockerfile +++ b/openig-docker/Dockerfile @@ -4,7 +4,6 @@ MAINTAINER Open Identity Platform Community Date: Thu, 9 Mar 2023 12:31:43 +0300 Subject: [PATCH 2/2] Fix websocket exception: java.lang.ClassCastException: class org.forgerock.http.header.CookieHeader cannot be cast to class org.forgerock.http.header.GenericHeader --- .../openig/websocket/ServerEndPoint.java | 33 ++++++++----------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/openig-core/src/main/java/org/openidentityplatform/openig/websocket/ServerEndPoint.java b/openig-core/src/main/java/org/openidentityplatform/openig/websocket/ServerEndPoint.java index e0b3d10b3..16c824c0e 100644 --- a/openig-core/src/main/java/org/openidentityplatform/openig/websocket/ServerEndPoint.java +++ b/openig-core/src/main/java/org/openidentityplatform/openig/websocket/ServerEndPoint.java @@ -1,29 +1,18 @@ package org.openidentityplatform.openig.websocket; +import org.forgerock.http.protocol.Header; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.websocket.*; +import javax.websocket.ClientEndpointConfig.Builder; +import javax.websocket.server.ServerEndpoint; import java.io.IOException; import java.nio.ByteBuffer; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import javax.websocket.ClientEndpointConfig; -import javax.websocket.CloseReason; -import javax.websocket.ContainerProvider; -import javax.websocket.Endpoint; -import javax.websocket.EndpointConfig; -import javax.websocket.MessageHandler; -import javax.websocket.OnClose; -import javax.websocket.OnError; -import javax.websocket.OnMessage; -import javax.websocket.OnOpen; -import javax.websocket.Session; -import javax.websocket.ClientEndpointConfig.Builder; -import javax.websocket.server.ServerEndpoint; - -import org.forgerock.http.header.GenericHeader; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - @ServerEndpoint(value = "/{level1}",configurator = Configurator.class) public class ServerEndPoint { @@ -58,8 +47,12 @@ public void start(Session session_client, EndpointConfig config) { @Override public void beforeRequest(Map> headers) { for (Entry entry : principal.request.getHeaders().entrySet()) { - if (entry.getKey().toLowerCase().startsWith("cookie")||entry.getKey().toLowerCase().startsWith("x-")||entry.getKey().equalsIgnoreCase("origin")||entry.getKey().equalsIgnoreCase("Authorization")||entry.getKey().toLowerCase().startsWith("sec-websocket-")) { - headers.put(entry.getKey(), ((GenericHeader)entry.getValue()).getValues()); + if (entry.getKey().toLowerCase().startsWith("cookie") + ||entry.getKey().toLowerCase().startsWith("x-") + ||entry.getKey().equalsIgnoreCase("origin") + ||entry.getKey().equalsIgnoreCase("Authorization") + ||entry.getKey().toLowerCase().startsWith("sec-websocket-")) { + headers.put(entry.getKey(), ((Header)entry.getValue()).getValues()); } } }