java.lang.Object
org.keycloak.models.sessions.infinispan.changes.remote.updater.BaseUpdater<String,RemoteUserSessionEntity>
org.keycloak.models.sessions.infinispan.changes.remote.updater.user.UserSessionUpdater
All Implemented Interfaces:
BiFunction<String,RemoteUserSessionEntity,RemoteUserSessionEntity>, Updater<String,RemoteUserSessionEntity>, org.keycloak.models.UserSessionModel

public class UserSessionUpdater extends BaseUpdater<String,RemoteUserSessionEntity> implements org.keycloak.models.UserSessionModel
The Updater implementation to keep track of modifications for UserSessionModel.
  • Method Details

    • onlineFactory

      Returns:
      The UpdaterFactory implementation to create online sessions instances of UserSessionModel.
    • offlineFactory

      Returns:
      The UpdaterFactory implementation to create offline sessions instances of UserSessionModel.
    • apply

      public RemoteUserSessionEntity apply(String ignored, RemoteUserSessionEntity userSessionEntity)
      Specified by:
      apply in interface BiFunction<String,RemoteUserSessionEntity,RemoteUserSessionEntity>
    • computeExpiration

      public Expiration computeExpiration()
      Description copied from interface: Updater
      Computes the expiration data for Infinispan cache.
      Specified by:
      computeExpiration in interface Updater<String,RemoteUserSessionEntity>
      Returns:
      The Expiration data.
    • getId

      public String getId()
      Specified by:
      getId in interface org.keycloak.models.UserSessionModel
    • getRealm

      public org.keycloak.models.RealmModel getRealm()
      Specified by:
      getRealm in interface org.keycloak.models.UserSessionModel
    • getBrokerSessionId

      public String getBrokerSessionId()
      Specified by:
      getBrokerSessionId in interface org.keycloak.models.UserSessionModel
    • getBrokerUserId

      public String getBrokerUserId()
      Specified by:
      getBrokerUserId in interface org.keycloak.models.UserSessionModel
    • getUser

      public org.keycloak.models.UserModel getUser()
      Specified by:
      getUser in interface org.keycloak.models.UserSessionModel
    • getLoginUsername

      public String getLoginUsername()
      Specified by:
      getLoginUsername in interface org.keycloak.models.UserSessionModel
    • getIpAddress

      public String getIpAddress()
      Specified by:
      getIpAddress in interface org.keycloak.models.UserSessionModel
    • getAuthMethod

      public String getAuthMethod()
      Specified by:
      getAuthMethod in interface org.keycloak.models.UserSessionModel
    • isRememberMe

      public boolean isRememberMe()
      Specified by:
      isRememberMe in interface org.keycloak.models.UserSessionModel
    • getStarted

      public int getStarted()
      Specified by:
      getStarted in interface org.keycloak.models.UserSessionModel
    • getLastSessionRefresh

      public int getLastSessionRefresh()
      Specified by:
      getLastSessionRefresh in interface org.keycloak.models.UserSessionModel
    • setLastSessionRefresh

      public void setLastSessionRefresh(int seconds)
      Specified by:
      setLastSessionRefresh in interface org.keycloak.models.UserSessionModel
    • isOffline

      public boolean isOffline()
      Specified by:
      isOffline in interface org.keycloak.models.UserSessionModel
    • getAuthenticatedClientSessions

      public Map<String,org.keycloak.models.AuthenticatedClientSessionModel> getAuthenticatedClientSessions()
      Specified by:
      getAuthenticatedClientSessions in interface org.keycloak.models.UserSessionModel
    • removeAuthenticatedClientSessions

      public void removeAuthenticatedClientSessions(Collection<String> removedClientUUIDS)
      Specified by:
      removeAuthenticatedClientSessions in interface org.keycloak.models.UserSessionModel
    • getAuthenticatedClientSessionByClient

      public org.keycloak.models.AuthenticatedClientSessionModel getAuthenticatedClientSessionByClient(String clientUUID)
      Specified by:
      getAuthenticatedClientSessionByClient in interface org.keycloak.models.UserSessionModel
    • getNote

      public String getNote(String name)
      Specified by:
      getNote in interface org.keycloak.models.UserSessionModel
    • setNote

      public void setNote(String name, String value)
      Specified by:
      setNote in interface org.keycloak.models.UserSessionModel
    • removeNote

      public void removeNote(String name)
      Specified by:
      removeNote in interface org.keycloak.models.UserSessionModel
    • getNotes

      public Map<String,String> getNotes()
      Specified by:
      getNotes in interface org.keycloak.models.UserSessionModel
    • getState

      public org.keycloak.models.UserSessionModel.State getState()
      Specified by:
      getState in interface org.keycloak.models.UserSessionModel
    • setState

      public void setState(org.keycloak.models.UserSessionModel.State state)
      Specified by:
      setState in interface org.keycloak.models.UserSessionModel
    • restartSession

      public void restartSession(org.keycloak.models.RealmModel realm, org.keycloak.models.UserModel user, String loginUsername, String ipAddress, String authMethod, boolean rememberMe, String brokerSessionId, String brokerUserId)
      Specified by:
      restartSession in interface org.keycloak.models.UserSessionModel
    • getPersistenceState

      public org.keycloak.models.UserSessionModel.SessionPersistenceState getPersistenceState()
      Specified by:
      getPersistenceState in interface org.keycloak.models.UserSessionModel
    • isTransient

      public boolean isTransient()
      Specified by:
      isTransient in interface Updater<String,RemoteUserSessionEntity>
      Overrides:
      isTransient in class BaseUpdater<String,RemoteUserSessionEntity>
      Returns:
      true if the entity is transient and shouldn't be stored in the Infinispan cache.
    • isUnchanged

      protected boolean isUnchanged()
      Specified by:
      isUnchanged in class BaseUpdater<String,RemoteUserSessionEntity>
      Returns:
      true if the entity was changed after being created/read.
    • initialize

      public void initialize(org.keycloak.models.UserSessionModel.SessionPersistenceState persistenceState, org.keycloak.models.RealmModel realm, org.keycloak.models.UserModel user, AuthenticatedClientSessionMapping clientSessions)
      Initializes this class with references to other models classes.
      Parameters:
      persistenceState - The UserSessionModel.SessionPersistenceState.
      realm - The RealmModel to where this user session belongs.
      user - The UserModel associated to this user session.
      clientSessions - The Map associated to this use session.
    • isInitialized

      public boolean isInitialized()
      Returns:
      true if it is already initialized.