org.keycloak.models

## Interface UserSessionModel

- All Known Subinterfaces:
    OfflineUserSessionModel
  All Known Implementing Classes:
    PersistentUserSessionAdapter, UserSessionAdapter

      public interface UserSessionModel

  Author:
    Stian Thorgersen

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static class` | `UserSessionModel.SessionPersistenceState` Flag used when creating user session
    `static class` | `UserSessionModel.State`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `default 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()`
    `RealmModel` | `getRealm()`
    `int` | `getStarted()`
    `UserSessionModel.State` | `getState()`
    `UserModel` | `getUser()`
    `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 seconds)`
    `void` | `setNote(String name, String value)`
    `void` | `setState(UserSessionModel.State state)`

- - ### Method Detail

    - #### getId

          String getId()

    - #### getRealm

          RealmModel getRealm()

    - #### getBrokerSessionId

          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
      Returns:

    - #### getBrokerUserId

          String getBrokerUserId()

    - #### getUser

          UserModel getUser()

    - #### getLoginUsername

          String getLoginUsername()

    - #### getIpAddress

          String getIpAddress()

    - #### getAuthMethod

          String getAuthMethod()

    - #### isRememberMe

          boolean isRememberMe()

    - #### getStarted

          int getStarted()

    - #### getLastSessionRefresh

          int getLastSessionRefresh()

    - #### setLastSessionRefresh

          void setLastSessionRefresh(int seconds)

    - #### isOffline

          boolean isOffline()

    - #### getAuthenticatedClientSessions

          Map<String,AuthenticatedClientSessionModel> getAuthenticatedClientSessions()

      Returns map where key is ID of the client (its UUID) and value is ID respective `AuthenticatedClientSessionModel` object.
      Returns:

    - #### getAuthenticatedClientSessionByClient

          default AuthenticatedClientSessionModel getAuthenticatedClientSessionByClient(String clientUUID)

      Returns a client session for the given client UUID.
      Returns:

    - #### removeAuthenticatedClientSessions

          void removeAuthenticatedClientSessions(Collection<String> removedClientUUIDS)

      Removes authenticated client sessions for all clients whose UUID is present in `removedClientUUIDS` parameter.
      Parameters:
        `removedClientUUIDS` -

    - #### getNote

          String getNote(String name)

    - #### setNote

          void setNote(String name,
                       String value)

    - #### removeNote

          void removeNote(String name)

    - #### getNotes

          Map<String,String> getNotes()

    - #### getState

          UserSessionModel.State getState()

    - #### setState

          void setState(UserSessionModel.State state)

    - #### restartSession

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

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