Class UserSessionUpdater
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> UserSessionModel
public class UserSessionUpdater
extends BaseUpdater<String,RemoteUserSessionEntity>
implements UserSessionModel
The
Updater
implementation to keep track of modifications for UserSessionModel
.-
Nested Class Summary
Nested classes/interfaces inherited from class org.keycloak.models.sessions.infinispan.changes.remote.updater.BaseUpdater
BaseUpdater.UpdaterState
Nested classes/interfaces inherited from interface org.keycloak.models.UserSessionModel
UserSessionModel.SessionPersistenceState, UserSessionModel.State
-
Field Summary
Fields inherited from interface org.keycloak.models.sessions.infinispan.changes.remote.updater.Updater
NO_VERSION
Fields inherited from interface org.keycloak.models.UserSessionModel
CORRESPONDING_SESSION_ID
-
Method Summary
Modifier and TypeMethodDescriptionapply
(String ignored, RemoteUserSessionEntity userSessionEntity) Computes the expiration data for Infinispan cache.getAuthenticatedClientSessionByClient
(String clientUUID) Returns a client session for the given client UUID.Returns map where key is ID of the client (its UUID) and value is ID respectiveAuthenticatedClientSessionModel
object.If created via a broker external login, this is an identifier that can be used to match external broker backchannel logout requests to a UserSessiongetId()
int
getNotes()
getRealm()
int
getState()
getUser()
void
initialize
(UserSessionModel.SessionPersistenceState persistenceState, RealmModel realm, UserModel user, Map<String, AuthenticatedClientSessionModel> clientSessions) Initializes this class with references to other models classes.boolean
boolean
boolean
boolean
protected boolean
void
removeAuthenticatedClientSessions
(Collection<String> removedClientUUIDS) Removes authenticated client sessions for all clients whose UUID is present inremovedClientUUIDS
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) Set the last session refresh timestamp for the user session.void
void
setState
(UserSessionModel.State state) Methods inherited from class org.keycloak.models.sessions.infinispan.changes.remote.updater.BaseUpdater
equals, getKey, getValue, getVersionRead, hashCode, isCreated, isDeleted, isReadOnly, markDeleted, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.function.BiFunction
andThen
Methods inherited from interface org.keycloak.models.sessions.infinispan.changes.remote.updater.Updater
hasVersion
-
Method Details
-
onlineFactory
- Returns:
- The
UpdaterFactory
implementation to create online sessions instances ofUserSessionModel
.
-
offlineFactory
- Returns:
- The
UpdaterFactory
implementation to create offline sessions instances ofUserSessionModel
.
-
apply
- Specified by:
apply
in interfaceBiFunction<String,
RemoteUserSessionEntity, RemoteUserSessionEntity>
-
computeExpiration
Description copied from interface:Updater
Computes the expiration data for Infinispan cache.- Specified by:
computeExpiration
in interfaceUpdater<String,
RemoteUserSessionEntity> - Returns:
- The
Expiration
data.
-
getId
- Specified by:
getId
in interfaceUserSessionModel
-
getRealm
- Specified by:
getRealm
in interfaceUserSessionModel
-
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 interfaceUserSessionModel
- Returns:
-
getBrokerUserId
- Specified by:
getBrokerUserId
in interfaceUserSessionModel
-
getUser
- Specified by:
getUser
in interfaceUserSessionModel
-
getLoginUsername
- Specified by:
getLoginUsername
in interfaceUserSessionModel
-
getIpAddress
- Specified by:
getIpAddress
in interfaceUserSessionModel
-
getAuthMethod
- Specified by:
getAuthMethod
in interfaceUserSessionModel
-
isRememberMe
public boolean isRememberMe()- Specified by:
isRememberMe
in interfaceUserSessionModel
-
getStarted
public int getStarted()- Specified by:
getStarted
in interfaceUserSessionModel
-
getLastSessionRefresh
public int getLastSessionRefresh()- Specified by:
getLastSessionRefresh
in interfaceUserSessionModel
-
setLastSessionRefresh
public void setLastSessionRefresh(int seconds) Description copied from interface:UserSessionModel
Set the last session refresh timestamp for the user session. If the timestamp is smaller or equal than the current timestamp, the operation is ignored.- Specified by:
setLastSessionRefresh
in interfaceUserSessionModel
-
isOffline
public boolean isOffline()- Specified by:
isOffline
in interfaceUserSessionModel
-
getAuthenticatedClientSessions
Description copied from interface:UserSessionModel
Returns map where key is ID of the client (its UUID) and value is ID respectiveAuthenticatedClientSessionModel
object.- Specified by:
getAuthenticatedClientSessions
in interfaceUserSessionModel
- Returns:
-
removeAuthenticatedClientSessions
Description copied from interface:UserSessionModel
Removes authenticated client sessions for all clients whose UUID is present inremovedClientUUIDS
parameter.- Specified by:
removeAuthenticatedClientSessions
in interfaceUserSessionModel
-
getAuthenticatedClientSessionByClient
Description copied from interface:UserSessionModel
Returns a client session for the given client UUID.- Specified by:
getAuthenticatedClientSessionByClient
in interfaceUserSessionModel
- Returns:
-
getNote
- Specified by:
getNote
in interfaceUserSessionModel
-
setNote
- Specified by:
setNote
in interfaceUserSessionModel
-
removeNote
- Specified by:
removeNote
in interfaceUserSessionModel
-
getNotes
- Specified by:
getNotes
in interfaceUserSessionModel
-
getState
- Specified by:
getState
in interfaceUserSessionModel
-
setState
- Specified by:
setState
in interfaceUserSessionModel
-
restartSession
public void restartSession(RealmModel realm, UserModel user, String loginUsername, String ipAddress, String authMethod, boolean rememberMe, String brokerSessionId, String brokerUserId) - Specified by:
restartSession
in interfaceUserSessionModel
-
getPersistenceState
- Specified by:
getPersistenceState
in interfaceUserSessionModel
- Returns:
- Persistence state of the session
-
isTransient
public boolean isTransient()- Specified by:
isTransient
in interfaceUpdater<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 classBaseUpdater<String,
RemoteUserSessionEntity> - Returns:
true
if the entity was changed after being created/read.
-
initialize
public void initialize(UserSessionModel.SessionPersistenceState persistenceState, RealmModel realm, UserModel user, Map<String, AuthenticatedClientSessionModel> clientSessions) Initializes this class with references to other models classes.- Parameters:
persistenceState
- TheUserSessionModel.SessionPersistenceState
.realm
- TheRealmModel
to where this user session belongs.user
- TheUserModel
associated to this user session.clientSessions
- TheMap
associated to this use session.
-
isInitialized
public boolean isInitialized()- Returns:
true
if it is already initialized.
-