org.keycloak.models.sessions.infinispan

## Class AuthenticationSessionAdapter

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

- All Implemented Interfaces:
    AuthenticationSessionModel, CommonClientSessionModel

      public class AuthenticationSessionAdapter
      extends Object
      implements AuthenticationSessionModel

  NOTE: Calling setter doesn't automatically enlist for update
  Author:
    Marek Posolda

- - ### Nested Class Summary

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

      `CommonClientSessionModel.Action, CommonClientSessionModel.ExecutionStatus`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AuthenticationSessionAdapter(KeycloakSession session, RootAuthenticationSessionAdapter parent, String tabId, AuthenticationSessionEntity entity)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addRequiredAction(String action)` Adds a required action to the authentication session.
    `void` | `addRequiredAction(UserModel.RequiredAction action)` Adds a required action to the authentication session.
    `void` | `clearAuthNotes()` Clears all authentication note.
    `void` | `clearClientNotes()` Clears all client notes.
    `void` | `clearExecutionStatus()` Clears execution status of the authentication session.
    `void` | `clearUserSessionNotes()` Clears all user session notes.
    `String` | `getAction()`
    `UserModel` | `getAuthenticatedUser()` Returns authenticated user that is associated to the authentication session.
    `String` | `getAuthNote(String name)` Retrieves value of the given authentication note to the given value.
    `ClientModel` | `getClient()`
    `String` | `getClientNote(String name)` Retrieves value of the given client note to the given value.
    `Map<String,String>` | `getClientNotes()` Retrieves the (name, value) map of client notes.
    `Set<String>` | `getClientScopes()` Gets client scope IDs from the authentication session.
    `Map<String,CommonClientSessionModel.ExecutionStatus>` | `getExecutionStatus()` Returns execution status of the authentication session.
    `RootAuthenticationSessionModel` | `getParentSession()` Returns the root authentication session that is parent of this authentication session.
    `String` | `getProtocol()`
    `RealmModel` | `getRealm()`
    `String` | `getRedirectUri()`
    `Set<String>` | `getRequiredActions()` Returns required actions that are attached to this client session.
    `String` | `getTabId()`
    `Map<String,String>` | `getUserSessionNotes()` Retrieves value of given user session note.
    `void` | `removeAuthNote(String name)` Removes the given authentication note.
    `void` | `removeClientNote(String name)` Removes the given client note.
    `void` | `removeRequiredAction(String action)` Removes a required action from the authentication session.
    `void` | `removeRequiredAction(UserModel.RequiredAction action)` Removes a required action from the authentication session.
    `void` | `setAction(String action)`
    `void` | `setAuthenticatedUser(UserModel user)` Sets authenticated user that is associated to the authentication session.
    `void` | `setAuthNote(String name, String value)` Sets the given authentication note to the given value.
    `void` | `setClientNote(String name, String value)` Sets the given client note to the given value.
    `void` | `setClientScopes(Set<String> clientScopes)` Sets client scope IDs to the authentication session.
    `void` | `setExecutionStatus(String authenticator, CommonClientSessionModel.ExecutionStatus status)` Sets execution status of the authentication session.
    `void` | `setProtocol(String protocol)`
    `void` | `setRedirectUri(String uri)`
    `void` | `setUserSessionNote(String name, String value)` Sets the given user session note to the given value.

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

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

- - ### Constructor Detail

    - #### AuthenticationSessionAdapter

          public AuthenticationSessionAdapter(KeycloakSession session,
                                              RootAuthenticationSessionAdapter parent,
                                              String tabId,
                                              AuthenticationSessionEntity entity)

  - ### Method Detail

    - #### getTabId

          public String getTabId()

      Specified by:
        `getTabId` in interface `AuthenticationSessionModel`
      Returns:
        ID of this subsession (in other words, usually browser tab). For lookup the AuthenticationSessionModel, you need: ID of rootSession (parent), client UUID and tabId. For lookup the ID of the parent, use `#getParentSession().getId()`

    - #### getParentSession

          public RootAuthenticationSessionModel getParentSession()

      Description copied from interface: `AuthenticationSessionModel`
      Returns the root authentication session that is parent of this authentication session.
      Specified by:
        `getParentSession` in interface `AuthenticationSessionModel`
      Returns:
        `RootAuthenticationSessionModel`

    - #### getRealm

          public RealmModel getRealm()

      Specified by:
        `getRealm` in interface `CommonClientSessionModel`

    - #### getClient

          public ClientModel getClient()

      Specified by:
        `getClient` in interface `CommonClientSessionModel`

    - #### getRedirectUri

          public String getRedirectUri()

      Specified by:
        `getRedirectUri` in interface `CommonClientSessionModel`

    - #### setRedirectUri

          public void setRedirectUri(String uri)

      Specified by:
        `setRedirectUri` in interface `CommonClientSessionModel`

    - #### getAction

          public String getAction()

      Specified by:
        `getAction` in interface `CommonClientSessionModel`

    - #### setAction

          public void setAction(String action)

      Specified by:
        `setAction` in interface `CommonClientSessionModel`

    - #### getClientScopes

          public Set<String> getClientScopes()

      Description copied from interface: `AuthenticationSessionModel`
      Gets client scope IDs from the authentication session.
      Specified by:
        `getClientScopes` in interface `AuthenticationSessionModel`
      Returns:
        `Set<String>` never returns `null`.

    - #### setClientScopes

          public void setClientScopes(Set<String> clientScopes)

      Description copied from interface: `AuthenticationSessionModel`
      Sets client scope IDs to the authentication session.
      Specified by:
        `setClientScopes` in interface `AuthenticationSessionModel`
      Parameters:
        `clientScopes` - `Set<String>` Can't be `null`.

    - #### getProtocol

          public String getProtocol()

      Specified by:
        `getProtocol` in interface `CommonClientSessionModel`

    - #### setProtocol

          public void setProtocol(String protocol)

      Specified by:
        `setProtocol` in interface `CommonClientSessionModel`

    - #### getClientNote

          public String getClientNote(String name)

      Description copied from interface: `AuthenticationSessionModel`
      Retrieves value of the given client note to the given value. Client notes are notes specific to client protocol. They are NOT cleared when authentication session is restarted.
      Specified by:
        `getClientNote` in interface `AuthenticationSessionModel`
      Parameters:
        `name` - `String` If `null` if provided then the method will return `null`.
      Returns:
        `String` or `null` if no client's note is set.

    - #### setClientNote

          public void setClientNote(String name,
                                    String value)

      Description copied from interface: `AuthenticationSessionModel`
      Sets the given client note to the given value. Client notes are notes specific to client protocol. They are NOT cleared when authentication session is restarted.
      Specified by:
        `setClientNote` in interface `AuthenticationSessionModel`
      Parameters:
        `name` - `String` If `null` is provided the method won't have an effect.
        `value` - `String` If `null` is provided the method won't have an effect.

    - #### removeClientNote

          public void removeClientNote(String name)

      Description copied from interface: `AuthenticationSessionModel`
      Removes the given client note. Client notes are notes specific to client protocol. They are NOT cleared when authentication session is restarted.
      Specified by:
        `removeClientNote` in interface `AuthenticationSessionModel`
      Parameters:
        `name` - `String` If `null` is provided the method won't have an effect.

    - #### getClientNotes

          public Map<String,String> getClientNotes()

      Description copied from interface: `AuthenticationSessionModel`
      Retrieves the (name, value) map of client notes. Client notes are notes specific to client protocol. They are NOT cleared when authentication session is restarted.
      Specified by:
        `getClientNotes` in interface `AuthenticationSessionModel`
      Returns:
        `Map<String, String>` never returns `null`.

    - #### clearClientNotes

          public void clearClientNotes()

      Description copied from interface: `AuthenticationSessionModel`
      Clears all client notes. Client notes are notes specific to client protocol. They are NOT cleared when authentication session is restarted.
      Specified by:
        `clearClientNotes` in interface `AuthenticationSessionModel`

    - #### getAuthNote

          public String getAuthNote(String name)

      Description copied from interface: `AuthenticationSessionModel`
      Retrieves value of the given authentication note to the given value. Authentication notes are notes used typically by authenticators and authentication flows. They are cleared when authentication session is restarted.
      Specified by:
        `getAuthNote` in interface `AuthenticationSessionModel`
      Parameters:
        `name` - `String` If `null` if provided then the method will return `null`.
      Returns:
        `String` or `null` if no authentication note is set.

    - #### setAuthNote

          public void setAuthNote(String name,
                                  String value)

      Description copied from interface: `AuthenticationSessionModel`
      Sets the given authentication note to the given value. Authentication notes are notes used typically by authenticators and authentication flows. They are cleared when authentication session is restarted.
      Specified by:
        `setAuthNote` in interface `AuthenticationSessionModel`
      Parameters:
        `name` - `String` If `null` is provided the method won't have an effect.
        `value` - `String` If `null` is provided the method won't have an effect.

    - #### removeAuthNote

          public void removeAuthNote(String name)

      Description copied from interface: `AuthenticationSessionModel`
      Removes the given authentication note. Authentication notes are notes used typically by authenticators and authentication flows. They are cleared when authentication session is restarted.
      Specified by:
        `removeAuthNote` in interface `AuthenticationSessionModel`
      Parameters:
        `name` - `String` If `null` is provided the method won't have an effect.

    - #### clearAuthNotes

          public void clearAuthNotes()

      Description copied from interface: `AuthenticationSessionModel`
      Clears all authentication note. Authentication notes are notes used typically by authenticators and authentication flows. They are cleared when authentication session is restarted.
      Specified by:
        `clearAuthNotes` in interface `AuthenticationSessionModel`

    - #### setUserSessionNote

          public void setUserSessionNote(String name,
                                         String value)

      Description copied from interface: `AuthenticationSessionModel`
      Sets the given user session note to the given value. User session notes are notes you want be applied to the UserSessionModel when the client session is attached to it.
      Specified by:
        `setUserSessionNote` in interface `AuthenticationSessionModel`
      Parameters:
        `name` - `String` If `null` is provided the method won't have an effect.
        `value` - `String` If `null` is provided the method won't have an effect.

    - #### getUserSessionNotes

          public Map<String,String> getUserSessionNotes()

      Description copied from interface: `AuthenticationSessionModel`
      Retrieves value of given user session note. User session notes are notes you want be applied to the UserSessionModel when the client session is attached to it.
      Specified by:
        `getUserSessionNotes` in interface `AuthenticationSessionModel`
      Returns:
        `Map<String, String>` never returns `null`

    - #### clearUserSessionNotes

          public void clearUserSessionNotes()

      Description copied from interface: `AuthenticationSessionModel`
      Clears all user session notes. User session notes are notes you want be applied to the UserSessionModel when the client session is attached to it.
      Specified by:
        `clearUserSessionNotes` in interface `AuthenticationSessionModel`

    - #### getRequiredActions

          public Set<String> getRequiredActions()

      Description copied from interface: `AuthenticationSessionModel`
      Returns required actions that are attached to this client session.
      Specified by:
        `getRequiredActions` in interface `AuthenticationSessionModel`
      Returns:
        `Set<String>` Never returns `null`.

    - #### addRequiredAction

          public void addRequiredAction(String action)

      Description copied from interface: `AuthenticationSessionModel`
      Adds a required action to the authentication session.
      Specified by:
        `addRequiredAction` in interface `AuthenticationSessionModel`
      Parameters:
        `action` - `String` Can't be `null`.

    - #### removeRequiredAction

          public void removeRequiredAction(String action)

      Description copied from interface: `AuthenticationSessionModel`
      Removes a required action from the authentication session.
      Specified by:
        `removeRequiredAction` in interface `AuthenticationSessionModel`
      Parameters:
        `action` - `String` Can't be `null`.

    - #### addRequiredAction

          public void addRequiredAction(UserModel.RequiredAction action)

      Description copied from interface: `AuthenticationSessionModel`
      Adds a required action to the authentication session.
      Specified by:
        `addRequiredAction` in interface `AuthenticationSessionModel`
      Parameters:
        `action` - `UserModel.RequiredAction` Can't be `null`.

    - #### removeRequiredAction

          public void removeRequiredAction(UserModel.RequiredAction action)

      Description copied from interface: `AuthenticationSessionModel`
      Removes a required action from the authentication session.
      Specified by:
        `removeRequiredAction` in interface `AuthenticationSessionModel`
      Parameters:
        `action` - `UserModel.RequiredAction` Can't be `null`.

    - #### getExecutionStatus

          public Map<String,CommonClientSessionModel.ExecutionStatus> getExecutionStatus()

      Description copied from interface: `AuthenticationSessionModel`
      Returns execution status of the authentication session.
      Specified by:
        `getExecutionStatus` in interface `AuthenticationSessionModel`
      Returns:
        `Map<String, ExecutionStatus>` Never returns `null`.

    - #### setExecutionStatus

          public void setExecutionStatus(String authenticator,
                                         CommonClientSessionModel.ExecutionStatus status)

      Description copied from interface: `AuthenticationSessionModel`
      Sets execution status of the authentication session.
      Specified by:
        `setExecutionStatus` in interface `AuthenticationSessionModel`
      Parameters:
        `authenticator` - `String` Can't be `null`.
        `status` - `ExecutionStatus` Can't be `null`.

    - #### clearExecutionStatus

          public void clearExecutionStatus()

      Description copied from interface: `AuthenticationSessionModel`
      Clears execution status of the authentication session.
      Specified by:
        `clearExecutionStatus` in interface `AuthenticationSessionModel`

    - #### getAuthenticatedUser

          public UserModel getAuthenticatedUser()

      Description copied from interface: `AuthenticationSessionModel`
      Returns authenticated user that is associated to the authentication session.
      Specified by:
        `getAuthenticatedUser` in interface `AuthenticationSessionModel`
      Returns:
        `UserModel` or null if there's no authenticated user.

    - #### setAuthenticatedUser

          public void setAuthenticatedUser(UserModel user)

      Description copied from interface: `AuthenticationSessionModel`
      Sets authenticated user that is associated to the authentication session.
      Specified by:
        `setAuthenticatedUser` in interface `AuthenticationSessionModel`
      Parameters:
        `user` - `UserModel` If `null` then `null` will be set to the authenticated user.

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