Package org.keycloak.services.managers
Class AuthenticationSessionManager
- java.lang.Object
-
- org.keycloak.services.managers.AuthenticationSessionManager
-
public class AuthenticationSessionManager extends Object
- Author:
- Marek Posolda
-
-
Field Summary
Fields Modifier and Type Field Description static intAUTH_SESSION_COOKIE_LIMITstatic StringAUTH_SESSION_ID
-
Constructor Summary
Constructors Constructor Description AuthenticationSessionManager(KeycloakSession session)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RootAuthenticationSessionModelcreateAuthenticationSession(RealmModel realm, boolean browserCookie)Creates a fresh authentication session for the given realm .AuthenticationSessionModelgetAuthenticationSessionByIdAndClient(RealmModel realm, String authSessionId, ClientModel client, String tabId)AuthenticationSessionModelgetCurrentAuthenticationSession(RealmModel realm, ClientModel client, String tabId)Returns current authentication session if it exists, otherwise returnsnull.RootAuthenticationSessionModelgetCurrentRootAuthenticationSession(RealmModel realm)UserSessionModelgetUserSession(AuthenticationSessionModel authSession)UserSessionModelgetUserSessionFromAuthCookie(RealmModel realm)voidremoveAuthenticationSession(RealmModel realm, AuthenticationSessionModel authSession, boolean expireRestartCookie)voidsetAuthSessionCookie(String authSessionId, RealmModel realm)
-
-
-
Field Detail
-
AUTH_SESSION_ID
public static final String AUTH_SESSION_ID
- See Also:
- Constant Field Values
-
AUTH_SESSION_COOKIE_LIMIT
public static final int AUTH_SESSION_COOKIE_LIMIT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AuthenticationSessionManager
public AuthenticationSessionManager(KeycloakSession session)
-
-
Method Detail
-
createAuthenticationSession
public RootAuthenticationSessionModel createAuthenticationSession(RealmModel realm, boolean browserCookie)
Creates a fresh authentication session for the given realm . Optionally sets the browser authentication session cookieAUTH_SESSION_IDwith the ID of the new session.- Parameters:
realm-browserCookie- Set the cookie in the browser for the- Returns:
-
getCurrentRootAuthenticationSession
public RootAuthenticationSessionModel getCurrentRootAuthenticationSession(RealmModel realm)
-
getUserSessionFromAuthCookie
public UserSessionModel getUserSessionFromAuthCookie(RealmModel realm)
-
getCurrentAuthenticationSession
public AuthenticationSessionModel getCurrentAuthenticationSession(RealmModel realm, ClientModel client, String tabId)
Returns current authentication session if it exists, otherwise returnsnull.- Parameters:
realm-- Returns:
-
setAuthSessionCookie
public void setAuthSessionCookie(String authSessionId, RealmModel realm)
- Parameters:
authSessionId- decoded authSessionId (without route info attached)realm-
-
removeAuthenticationSession
public void removeAuthenticationSession(RealmModel realm, AuthenticationSessionModel authSession, boolean expireRestartCookie)
-
getUserSession
public UserSessionModel getUserSession(AuthenticationSessionModel authSession)
-
getAuthenticationSessionByIdAndClient
public AuthenticationSessionModel getAuthenticationSessionByIdAndClient(RealmModel realm, String authSessionId, ClientModel client, String tabId)
-
-