org.keycloak.models.sessions.infinispan

## Class RootAuthenticationSessionAdapter

- java.lang.Object
- - org.keycloak.models.sessions.infinispan.RootAuthenticationSessionAdapter

- All Implemented Interfaces:
    RootAuthenticationSessionModel

      public class RootAuthenticationSessionAdapter
      extends Object
      implements RootAuthenticationSessionModel

  Author:
    Marek Posolda

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.keycloak.sessions.RootAuthenticationSessionModel

      `RootAuthenticationSessionModel.SearchableFields`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RootAuthenticationSessionAdapter(KeycloakSession session, InfinispanAuthenticationSessionProvider provider, org.infinispan.Cache<String,RootAuthenticationSessionEntity> cache, RealmModel realm, RootAuthenticationSessionEntity entity, int authSessionsLimt)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `AuthenticationSessionModel` | `createAuthenticationSession(ClientModel client)` Create a new authentication session and returns it.
    `AuthenticationSessionModel` | `getAuthenticationSession(ClientModel client, String tabId)` Returns an authentication session for the particular client and tab or null if it doesn't yet exists.
    `Map<String,AuthenticationSessionModel>` | `getAuthenticationSessions()` Returns authentication sessions for the root authentication session.
    `String` | `getId()` Returns id of the root authentication session.
    `RealmModel` | `getRealm()` Returns realm associated to the root authentication session.
    `int` | `getTimestamp()` Returns timestamp when the root authentication session was created or updated.
    `void` | `removeAuthenticationSessionByTabId(String tabId)` Removes the authentication session specified by tab id from the root authentication session.
    `void` | `restartSession(RealmModel realm)` Will completely restart whole state of authentication session.
    `void` | `setTimestamp(int timestamp)` Sets a timestamp when the root authentication session was created or updated.

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

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

- - ### Constructor Detail

    - #### RootAuthenticationSessionAdapter

          public RootAuthenticationSessionAdapter(KeycloakSession session,
                                                  InfinispanAuthenticationSessionProvider provider,
                                                  org.infinispan.Cache<String,RootAuthenticationSessionEntity> cache,
                                                  RealmModel realm,
                                                  RootAuthenticationSessionEntity entity,
                                                  int authSessionsLimt)

  - ### Method Detail

    - #### getId

          public String getId()

      Description copied from interface: `RootAuthenticationSessionModel`
      Returns id of the root authentication session.
      Specified by:
        `getId` in interface `RootAuthenticationSessionModel`
      Returns:
        `String`

    - #### getRealm

          public RealmModel getRealm()

      Description copied from interface: `RootAuthenticationSessionModel`
      Returns realm associated to the root authentication session.
      Specified by:
        `getRealm` in interface `RootAuthenticationSessionModel`
      Returns:
        `RealmModel`

    - #### getTimestamp

          public int getTimestamp()

      Description copied from interface: `RootAuthenticationSessionModel`
      Returns timestamp when the root authentication session was created or updated.
      Specified by:
        `getTimestamp` in interface `RootAuthenticationSessionModel`
      Returns:
        `int`

    - #### setTimestamp

          public void setTimestamp(int timestamp)

      Description copied from interface: `RootAuthenticationSessionModel`
      Sets a timestamp when the root authentication session was created or updated.
      Specified by:
        `setTimestamp` in interface `RootAuthenticationSessionModel`
      Parameters:
        `timestamp` - `int`

    - #### getAuthenticationSessions

          public Map<String,AuthenticationSessionModel> getAuthenticationSessions()

      Description copied from interface: `RootAuthenticationSessionModel`
      Returns authentication sessions for the root authentication session. Key is tabId, Value is AuthenticationSessionModel.
      Specified by:
        `getAuthenticationSessions` in interface `RootAuthenticationSessionModel`
      Returns:
        `Map<String, AuthenticationSessionModel>` authentication sessions or empty map if no authentication sessions are present. Never return null.

    - #### getAuthenticationSession

          public AuthenticationSessionModel getAuthenticationSession(ClientModel client,
                                                                     String tabId)

      Description copied from interface: `RootAuthenticationSessionModel`
      Returns an authentication session for the particular client and tab or null if it doesn't yet exists.
      Specified by:
        `getAuthenticationSession` in interface `RootAuthenticationSessionModel`
      Parameters:
        `client` - `ClientModel` If `null` is provided the method will return `null`.
        `tabId` - `String` If `null` is provided the method will return `null`.
      Returns:
        `AuthenticationSessionModel` or `null` in no authentication session is found.

    - #### createAuthenticationSession

          public AuthenticationSessionModel createAuthenticationSession(ClientModel client)

      Description copied from interface: `RootAuthenticationSessionModel`
      Create a new authentication session and returns it.
      Specified by:
        `createAuthenticationSession` in interface `RootAuthenticationSessionModel`
      Parameters:
        `client` - `ClientModel` Can't be `null`.
      Returns:
        `AuthenticationSessionModel` non-null fresh authentication session. Never returns `null`.

    - #### removeAuthenticationSessionByTabId

          public void removeAuthenticationSessionByTabId(String tabId)

      Description copied from interface: `RootAuthenticationSessionModel`
      Removes the authentication session specified by tab id from the root authentication session. If there's no child authentication session left in the root authentication session, it's removed as well.
      Specified by:
        `removeAuthenticationSessionByTabId` in interface `RootAuthenticationSessionModel`
      Parameters:
        `tabId` - `String` Can't be `null`.

    - #### restartSession

          public void restartSession(RealmModel realm)

      Description copied from interface: `RootAuthenticationSessionModel`
      Will completely restart whole state of authentication session. It will just keep same ID. It will setup it with provided realm.
      Specified by:
        `restartSession` in interface `RootAuthenticationSessionModel`
      Parameters:
        `realm` - `RealmModel` Associated realm to the root authentication session.

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