From da799b18c3e5d42ff347305f6d53b3605bbf6595 Mon Sep 17 00:00:00 2001 From: Stan Silvert Date: Tue, 20 May 2014 19:58:08 -0400 Subject: [PATCH] Make UndertowUserSessionManagement class usable without the Servlet API. --- .../adapters/undertow/ServletRequestAuthenticator.java | 2 +- .../adapters/undertow/UndertowUserSessionManagement.java | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/integration/undertow/src/main/java/org/keycloak/adapters/undertow/ServletRequestAuthenticator.java b/integration/undertow/src/main/java/org/keycloak/adapters/undertow/ServletRequestAuthenticator.java index f73227f287..139683abc2 100755 --- a/integration/undertow/src/main/java/org/keycloak/adapters/undertow/ServletRequestAuthenticator.java +++ b/integration/undertow/src/main/java/org/keycloak/adapters/undertow/ServletRequestAuthenticator.java @@ -66,7 +66,7 @@ public class ServletRequestAuthenticator extends UndertowRequestAuthenticator { HttpServletRequest req = (HttpServletRequest) servletRequestContext.getServletRequest(); HttpSession session = req.getSession(true); session.setAttribute(KeycloakUndertowAccount.class.getName(), account); - userSessionManagement.login(servletRequestContext.getDeployment().getSessionManager(), session, account.getPrincipal().getName(), account.getKeycloakSecurityContext().getToken().getSessionState()); + userSessionManagement.login(servletRequestContext.getDeployment().getSessionManager(), session.getId(), account.getPrincipal().getName(), account.getKeycloakSecurityContext().getToken().getSessionState()); } } diff --git a/integration/undertow/src/main/java/org/keycloak/adapters/undertow/UndertowUserSessionManagement.java b/integration/undertow/src/main/java/org/keycloak/adapters/undertow/UndertowUserSessionManagement.java index 1c11d37517..f9df4b05c3 100755 --- a/integration/undertow/src/main/java/org/keycloak/adapters/undertow/UndertowUserSessionManagement.java +++ b/integration/undertow/src/main/java/org/keycloak/adapters/undertow/UndertowUserSessionManagement.java @@ -8,7 +8,6 @@ import io.undertow.server.session.SessionManager; import io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler; import org.jboss.logging.Logger; -import javax.servlet.http.HttpSession; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -62,9 +61,7 @@ public class UndertowUserSessionManagement implements SessionListener { return set; } - public synchronized void login(SessionManager manager, HttpSession session, String username, String keycloakSessionId) { - String sessionId = session.getId(); - + public synchronized void login(SessionManager manager, String sessionId, String username, String keycloakSessionId) { UserSessions sessions = userSessionMap.get(username); if (sessions == null) { sessions = new UserSessions();