From e6b9364c39647420311af938dca1e76c594187a7 Mon Sep 17 00:00:00 2001 From: scranen Date: Fri, 26 Oct 2018 14:56:47 +0200 Subject: [PATCH] KEYCLOAK-4342 PR comments --- .../java/org/keycloak/adapters/CookieTokenStore.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/adapters/oidc/adapter-core/src/main/java/org/keycloak/adapters/CookieTokenStore.java b/adapters/oidc/adapter-core/src/main/java/org/keycloak/adapters/CookieTokenStore.java index c13cbfa493..a3a44571f5 100755 --- a/adapters/oidc/adapter-core/src/main/java/org/keycloak/adapters/CookieTokenStore.java +++ b/adapters/oidc/adapter-core/src/main/java/org/keycloak/adapters/CookieTokenStore.java @@ -104,17 +104,18 @@ public class CookieTokenStore { } static String getCookiePath(KeycloakDeployment deployment, HttpFacade facade) { - if (deployment.getAdapterStateCookiePath().startsWith("/")) { - return deployment.getAdapterStateCookiePath(); + String path = deployment.getAdapterStateCookiePath() == null ? "" : deployment.getAdapterStateCookiePath().trim(); + if (path.startsWith("/")) { + return path; } String contextPath = getContextPath(facade); StringBuilder cookiePath = new StringBuilder(contextPath); - if (!contextPath.endsWith("/") && !deployment.getAdapterStateCookiePath().isEmpty()) { + if (!contextPath.endsWith("/") && !path.isEmpty()) { cookiePath.append("/"); } - return cookiePath.append(deployment.getAdapterStateCookiePath()).toString(); + return cookiePath.append(path).toString(); } - + static String getContextPath(HttpFacade facade) { String uri = facade.getRequest().getURI(); String path = KeycloakUriBuilder.fromUri(uri).getPath();