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 int
AUTH_SESSION_COOKIE_LIMIT
static String
AUTH_SESSION_ID
-
Constructor Summary
Constructors Constructor Description AuthenticationSessionManager(KeycloakSession session)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RootAuthenticationSessionModel
createAuthenticationSession(RealmModel realm, boolean browserCookie)
Creates a fresh authentication session for the given realm .AuthenticationSessionModel
getAuthenticationSessionByIdAndClient(RealmModel realm, String authSessionId, ClientModel client, String tabId)
AuthenticationSessionModel
getCurrentAuthenticationSession(RealmModel realm, ClientModel client, String tabId)
Returns current authentication session if it exists, otherwise returnsnull
.RootAuthenticationSessionModel
getCurrentRootAuthenticationSession(RealmModel realm)
UserSessionModel
getUserSession(AuthenticationSessionModel authSession)
UserSessionModel
getUserSessionFromAuthCookie(RealmModel realm)
void
removeAuthenticationSession(RealmModel realm, AuthenticationSessionModel authSession, boolean expireRestartCookie)
void
setAuthSessionCookie(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_ID
with 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)
-
-