org.keycloak.sessions

## Interface RootAuthenticationSessionModel

- All Known Implementing Classes:
    AbstractRootAuthenticationSessionModel, MapRootAuthenticationSessionAdapter, RootAuthenticationSessionAdapter

      public interface RootAuthenticationSessionModel

  Represents usually one browser session with potentially many browser tabs. Every browser tab is represented by `AuthenticationSessionModel` of different client.
  Author:
    Marek Posolda

- - ### Method Summary

    All Methods Instance Methods Abstract 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.

- - ### Method Detail

    - #### getId

          String getId()

      Returns id of the root authentication session.
      Returns:
        `String`

    - #### getRealm

          RealmModel getRealm()

      Returns realm associated to the root authentication session.
      Returns:
        `RealmModel`

    - #### getTimestamp

          int getTimestamp()

      Returns timestamp when the root authentication session was created or updated.
      Returns:
        `int`

    - #### setTimestamp

          void setTimestamp(int timestamp)

      Sets a timestamp when the root authentication session was created or updated.
      Parameters:
        `timestamp` - `int`

    - #### getAuthenticationSessions

          Map<String,AuthenticationSessionModel> getAuthenticationSessions()

      Returns authentication sessions for the root authentication session. Key is tabId, Value is AuthenticationSessionModel.
      Returns:
        `Map<String, AuthenticationSessionModel>` authentication sessions or empty map if no authentication sessions are present. Never return null.

    - #### getAuthenticationSession

          AuthenticationSessionModel getAuthenticationSession(ClientModel client,
                                                              String tabId)

      Returns an authentication session for the particular client and tab or null if it doesn't yet exists.
      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

          AuthenticationSessionModel createAuthenticationSession(ClientModel client)

      Create a new authentication session and returns it. Overwrites existing session for particular client if already exists.
      Parameters:
        `client` - `ClientModel` Can't be `null`.
      Returns:
        `AuthenticationSessionModel` non-null fresh authentication session. Never returns `null`.

    - #### removeAuthenticationSessionByTabId

          void removeAuthenticationSessionByTabId(String tabId)

      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.
      Parameters:
        `tabId` - `String` Can't be `null`.

    - #### restartSession

          void restartSession(RealmModel realm)

      Will completely restart whole state of authentication session. It will just keep same ID. It will setup it with provided realm.
      Parameters:
        `realm` - `RealmModel` Associated realm to the root authentication session.

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