org.keycloak.models.sessions.infinispan

## Class UserSessionAdapter

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

- All Implemented Interfaces:
    UserSessionModel

      public class UserSessionAdapter
      extends Object
      implements UserSessionModel

  Author:
    Stian Thorgersen

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.keycloak.models.UserSessionModel

      `UserSessionModel.SearchableFields, UserSessionModel.SessionPersistenceState, UserSessionModel.State`

  - ### Field Summary

    - ### Fields inherited from interface org.keycloak.models.UserSessionModel

      `CORRESPONDING_SESSION_ID`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UserSessionAdapter(KeycloakSession session, InfinispanUserSessionProvider provider, InfinispanChangelogBasedTransaction<String,UserSessionEntity> userSessionUpdateTx, InfinispanChangelogBasedTransaction<UUID,AuthenticatedClientSessionEntity> clientSessionUpdateTx, RealmModel realm, UserSessionEntity entity, boolean offline)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)`
    `AuthenticatedClientSessionModel` | `getAuthenticatedClientSessionByClient(String clientUUID)` Returns a client session for the given client UUID.
    `Map<String,AuthenticatedClientSessionModel>` | `getAuthenticatedClientSessions()` Returns map where key is ID of the client (its UUID) and value is ID respective `AuthenticatedClientSessionModel` object.
    `String` | `getAuthMethod()`
    `String` | `getBrokerSessionId()` If created via a broker external login, this is an identifier that can be used to match external broker backchannel logout requests to a UserSession
    `String` | `getBrokerUserId()`
    `String` | `getId()`
    `String` | `getIpAddress()`
    `int` | `getLastSessionRefresh()`
    `String` | `getLoginUsername()`
    `String` | `getNote(String name)`
    `Map<String,String>` | `getNotes()`
    `UserSessionModel.SessionPersistenceState` | `getPersistenceState()`
    `RealmModel` | `getRealm()`
    `int` | `getStarted()`
    `UserSessionModel.State` | `getState()`
    `UserModel` | `getUser()`
    `int` | `hashCode()`
    `boolean` | `isOffline()`
    `boolean` | `isRememberMe()`
    `void` | `removeAuthenticatedClientSessions(Collection<String> removedClientUUIDS)` Removes authenticated client sessions for all clients whose UUID is present in `removedClientUUIDS` parameter.
    `void` | `removeNote(String name)`
    `void` | `restartSession(RealmModel realm, UserModel user, String loginUsername, String ipAddress, String authMethod, boolean rememberMe, String brokerSessionId, String brokerUserId)`
    `void` | `setLastSessionRefresh(int lastSessionRefresh)`
    `void` | `setNote(String name, String value)`
    `void` | `setPersistenceState(UserSessionModel.SessionPersistenceState persistenceState)`
    `void` | `setState(UserSessionModel.State state)`

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

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

- - ### Constructor Detail

    - #### UserSessionAdapter

          public UserSessionAdapter(KeycloakSession session,
                                    InfinispanUserSessionProvider provider,
                                    InfinispanChangelogBasedTransaction<String,UserSessionEntity> userSessionUpdateTx,
                                    InfinispanChangelogBasedTransaction<UUID,AuthenticatedClientSessionEntity> clientSessionUpdateTx,
                                    RealmModel realm,
                                    UserSessionEntity entity,
                                    boolean offline)

  - ### Method Detail

    - #### getAuthenticatedClientSessions

          public Map<String,AuthenticatedClientSessionModel> getAuthenticatedClientSessions()

      Description copied from interface: `UserSessionModel`
      Returns map where key is ID of the client (its UUID) and value is ID respective `AuthenticatedClientSessionModel` object.
      Specified by:
        `getAuthenticatedClientSessions` in interface `UserSessionModel`
      Returns:

    - #### getAuthenticatedClientSessionByClient

          public AuthenticatedClientSessionModel getAuthenticatedClientSessionByClient(String clientUUID)

      Description copied from interface: `UserSessionModel`
      Returns a client session for the given client UUID.
      Specified by:
        `getAuthenticatedClientSessionByClient` in interface `UserSessionModel`
      Returns:

    - #### removeAuthenticatedClientSessions

          public void removeAuthenticatedClientSessions(Collection<String> removedClientUUIDS)

      Description copied from interface: `UserSessionModel`
      Removes authenticated client sessions for all clients whose UUID is present in `removedClientUUIDS` parameter.
      Specified by:
        `removeAuthenticatedClientSessions` in interface `UserSessionModel`

    - #### getId

          public String getId()

      Specified by:
        `getId` in interface `UserSessionModel`

    - #### getRealm

          public RealmModel getRealm()

      Specified by:
        `getRealm` in interface `UserSessionModel`

    - #### getBrokerSessionId

          public String getBrokerSessionId()

      Description copied from interface: `UserSessionModel`
      If created via a broker external login, this is an identifier that can be used to match external broker backchannel logout requests to a UserSession
      Specified by:
        `getBrokerSessionId` in interface `UserSessionModel`
      Returns:

    - #### getBrokerUserId

          public String getBrokerUserId()

      Specified by:
        `getBrokerUserId` in interface `UserSessionModel`

    - #### getUser

          public UserModel getUser()

      Specified by:
        `getUser` in interface `UserSessionModel`

    - #### getLoginUsername

          public String getLoginUsername()

      Specified by:
        `getLoginUsername` in interface `UserSessionModel`

    - #### getIpAddress

          public String getIpAddress()

      Specified by:
        `getIpAddress` in interface `UserSessionModel`

    - #### getAuthMethod

          public String getAuthMethod()

      Specified by:
        `getAuthMethod` in interface `UserSessionModel`

    - #### isRememberMe

          public boolean isRememberMe()

      Specified by:
        `isRememberMe` in interface `UserSessionModel`

    - #### getStarted

          public int getStarted()

      Specified by:
        `getStarted` in interface `UserSessionModel`

    - #### getLastSessionRefresh

          public int getLastSessionRefresh()

      Specified by:
        `getLastSessionRefresh` in interface `UserSessionModel`

    - #### setLastSessionRefresh

          public void setLastSessionRefresh(int lastSessionRefresh)

      Specified by:
        `setLastSessionRefresh` in interface `UserSessionModel`

    - #### isOffline

          public boolean isOffline()

      Specified by:
        `isOffline` in interface `UserSessionModel`

    - #### getNote

          public String getNote(String name)

      Specified by:
        `getNote` in interface `UserSessionModel`

    - #### setNote

          public void setNote(String name,
                              String value)

      Specified by:
        `setNote` in interface `UserSessionModel`

    - #### removeNote

          public void removeNote(String name)

      Specified by:
        `removeNote` in interface `UserSessionModel`

    - #### getNotes

          public Map<String,String> getNotes()

      Specified by:
        `getNotes` in interface `UserSessionModel`

    - #### getState

          public UserSessionModel.State getState()

      Specified by:
        `getState` in interface `UserSessionModel`

    - #### setState

          public void setState(UserSessionModel.State state)

      Specified by:
        `setState` in interface `UserSessionModel`

    - #### getPersistenceState

          public UserSessionModel.SessionPersistenceState getPersistenceState()

    - #### setPersistenceState

          public void setPersistenceState(UserSessionModel.SessionPersistenceState persistenceState)

    - #### restartSession

          public void restartSession(RealmModel realm,
                                     UserModel user,
                                     String loginUsername,
                                     String ipAddress,
                                     String authMethod,
                                     boolean rememberMe,
                                     String brokerSessionId,
                                     String brokerUserId)

      Specified by:
        `restartSession` in interface `UserSessionModel`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

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