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 and Description
    --- | ---
    `static int` | `AUTH_SESSION_COOKIE_LIMIT`
    `static String` | `AUTH_SESSION_ID`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AuthenticationSessionManager(KeycloakSession session)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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 returns `null`.
    `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)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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 cookie `AUTH_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 returns `null`.
      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)

Copyright © 2021 JBoss by Red Hat. All rights reserved.