org.keycloak.sessions

## Interface AuthenticationSessionProvider

- All Superinterfaces:
    Provider
  All Known Implementing Classes:
    InfinispanAuthenticationSessionProvider, MapRootAuthenticationSessionProvider

      public interface AuthenticationSessionProvider
      extends Provider

  Author:
    Marek Posolda

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `RootAuthenticationSessionModel` | `createRootAuthenticationSession(RealmModel realm)` Creates and registers a new authentication session with random ID.
    `RootAuthenticationSessionModel` | `createRootAuthenticationSession(RealmModel realm, String id)` Creates a new root authentication session specified by the provided realm and id.
    `default RootAuthenticationSessionModel` | `createRootAuthenticationSession(String id, RealmModel realm)` Deprecated. Use `createRootAuthenticationSession(RealmModel, String)` createRootAuthenticationSession} instead.
    `RootAuthenticationSessionModel` | `getRootAuthenticationSession(RealmModel realm, String authenticationSessionId)` Returns the root authentication session specified by the provided realm and id.
    `void` | `onClientRemoved(RealmModel realm, ClientModel client)` Removes all associated root authentication sessions to the given realm and client which was removed.
    `void` | `onRealmRemoved(RealmModel realm)` Removes all associated root authentication sessions to the given realm which was removed.
    `void` | `removeExpired(RealmModel realm)` Removes all expired root authentication sessions for the given realm.
    `void` | `removeRootAuthenticationSession(RealmModel realm, RootAuthenticationSessionModel authenticationSession)` Removes provided root authentication session.
    `void` | `updateNonlocalSessionAuthNotes(AuthenticationSessionCompoundId compoundId, Map<String,String> authNotesFragment)` Requests update of authNotes of a root authentication session that is not owned by this instance but might exist somewhere in the cluster.

    - ### Methods inherited from interface org.keycloak.provider.Provider

      `close`

- - ### Method Detail

    - #### createRootAuthenticationSession

          RootAuthenticationSessionModel createRootAuthenticationSession(RealmModel realm)

      Creates and registers a new authentication session with random ID. Authentication session entity will be prefilled with current timestamp, the given realm and client.
      Parameters:
        `realm` - `RealmModel` Can't be `null`.
      Returns:
        Returns created `RootAuthenticationSessionModel`. Never returns `null`.

    - #### createRootAuthenticationSession

          @Deprecated
          default RootAuthenticationSessionModel createRootAuthenticationSession(String id,
                                                                                             RealmModel realm)

      Deprecated. Use `createRootAuthenticationSession(RealmModel, String)` createRootAuthenticationSession} instead.
      Creates a new root authentication session specified by the provided id and realm.
      Parameters:
        `id` - `String` Id of newly created root authentication session. If `null` a random id will be generated.
        `realm` - `RealmModel` Can't be `null`.
      Returns:
        Returns created `RootAuthenticationSessionModel`. Never returns `null`.

    - #### createRootAuthenticationSession

          RootAuthenticationSessionModel createRootAuthenticationSession(RealmModel realm,
                                                                         String id)

      Creates a new root authentication session specified by the provided realm and id.
      Parameters:
        `realm` - `RealmModel` Can't be `null`.
        `id` - `String` Id of newly created root authentication session. If `null` a random id will be generated.
      Returns:
        Returns created `RootAuthenticationSessionModel`. Never returns `null`.

    - #### getRootAuthenticationSession

          RootAuthenticationSessionModel getRootAuthenticationSession(RealmModel realm,
                                                                      String authenticationSessionId)

      Returns the root authentication session specified by the provided realm and id.
      Parameters:
        `realm` - `RealmModel` Can't be `null`.
        `authenticationSessionId` - `RootAuthenticationSessionModel` If `null` then `null` will be returned.
      Returns:
        Returns found `RootAuthenticationSessionModel` or `null` if no root authentication session is found.

    - #### removeRootAuthenticationSession

          void removeRootAuthenticationSession(RealmModel realm,
                                               RootAuthenticationSessionModel authenticationSession)

      Removes provided root authentication session.
      Parameters:
        `realm` - `RealmModel` Associated realm to the given root authentication session.
        `authenticationSession` - `RootAuthenticationSessionModel` Can't be `null`.

    - #### removeExpired

          void removeExpired(RealmModel realm)

      Removes all expired root authentication sessions for the given realm.
      Parameters:
        `realm` - `RealmModel` Can't be `null`.

    - #### onRealmRemoved

          void onRealmRemoved(RealmModel realm)

      Removes all associated root authentication sessions to the given realm which was removed.
      Parameters:
        `realm` - `RealmModel` Can't be `null`.

    - #### onClientRemoved

          void onClientRemoved(RealmModel realm,
                               ClientModel client)

      Removes all associated root authentication sessions to the given realm and client which was removed.
      Parameters:
        `realm` - `RealmModel` Can't be `null`.
        `client` - `ClientModel` Can't be `null`.

    - #### updateNonlocalSessionAuthNotes

          void updateNonlocalSessionAuthNotes(AuthenticationSessionCompoundId compoundId,
                                              Map<String,String> authNotesFragment)

      Requests update of authNotes of a root authentication session that is not owned by this instance but might exist somewhere in the cluster.
      Parameters:
        `compoundId` - `AuthenticationSessionCompoundId` The method has no effect if `null`.
        `authNotesFragment` - `Map<String, String>` Map with authNote values. Auth note is removed if the corresponding value in the map is `null`. Map itself can't be `null`.

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