Class UserSessionAdapter<T extends SessionRefreshStore & UserSessionProvider>
java.lang.Object
org.keycloak.models.sessions.infinispan.UserSessionAdapter<T>
- All Implemented Interfaces:
UserSessionModel
public class UserSessionAdapter<T extends SessionRefreshStore & UserSessionProvider>
extends Object
implements UserSessionModel
- Author:
- Stian Thorgersen
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.keycloak.models.UserSessionModel
UserSessionModel.SessionPersistenceState, UserSessionModel.State -
Field Summary
Fields inherited from interface org.keycloak.models.UserSessionModel
CORRESPONDING_SESSION_ID -
Constructor Summary
ConstructorsConstructorDescriptionUserSessionAdapter(KeycloakSession session, UserModel user, T provider, SessionsChangelogBasedTransaction<String, UserSessionEntity> userSessionUpdateTx, SessionsChangelogBasedTransaction<EmbeddedClientSessionKey, AuthenticatedClientSessionEntity> clientSessionUpdateTx, RealmModel realm, UserSessionEntity entity, boolean offline) -
Method Summary
Modifier and TypeMethodDescriptionbooleangetAuthenticatedClientSessionByClient(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 respectiveAuthenticatedClientSessionModelobject.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()Note: will not be an address when a proxy does not provide a valid oneintgetNotes()getRealm()intgetState()getUser()inthashCode()booleanbooleanvoidremoveAuthenticatedClientSessions(Collection<String> removedClientUUIDS) Removes authenticated client sessions for all clients whose UUID is present inremovedClientUUIDSparameter.voidremoveNote(String name) voidrestartSession(RealmModel realm, UserModel user, String loginUsername, String ipAddress, String authMethod, boolean rememberMe, String brokerSessionId, String brokerUserId) voidsetLastSessionRefresh(int lastSessionRefresh) Set the last session refresh timestamp for the user session.voidvoidsetPersistenceState(UserSessionModel.SessionPersistenceState persistenceState) voidsetState(UserSessionModel.State state)
-
Constructor Details
-
UserSessionAdapter
public UserSessionAdapter(KeycloakSession session, UserModel user, T provider, SessionsChangelogBasedTransaction<String, UserSessionEntity> userSessionUpdateTx, SessionsChangelogBasedTransaction<EmbeddedClientSessionKey, AuthenticatedClientSessionEntity> clientSessionUpdateTx, RealmModel realm, UserSessionEntity entity, boolean offline)
-
-
Method Details
-
getAuthenticatedClientSessions
Description copied from interface:UserSessionModelReturns map where key is ID of the client (its UUID) and value is ID respectiveAuthenticatedClientSessionModelobject.Any direct modification via the
Mapinterface will throw anUnsupportedOperationException. To add a new mapping, use a method likeUserSessionProvider.createClientSession(RealmModel, ClientModel, UserSessionModel)or equivalent. To remove a mapping, useAuthenticatedClientSessionModel.detachFromUserSession().- Specified by:
getAuthenticatedClientSessionsin interfaceUserSessionModel
-
getAuthenticatedClientSessionByClient
Description copied from interface:UserSessionModelReturns a client session for the given client UUID.- Specified by:
getAuthenticatedClientSessionByClientin interfaceUserSessionModel- Returns:
-
removeAuthenticatedClientSessions
Description copied from interface:UserSessionModelRemoves authenticated client sessions for all clients whose UUID is present inremovedClientUUIDSparameter.- Specified by:
removeAuthenticatedClientSessionsin interfaceUserSessionModel
-
getId
- Specified by:
getIdin interfaceUserSessionModel
-
getRealm
- Specified by:
getRealmin interfaceUserSessionModel
-
getBrokerSessionId
Description copied from interface:UserSessionModelIf 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:
getBrokerSessionIdin interfaceUserSessionModel- Returns:
-
getBrokerUserId
- Specified by:
getBrokerUserIdin interfaceUserSessionModel
-
getUser
- Specified by:
getUserin interfaceUserSessionModel
-
getLoginUsername
- Specified by:
getLoginUsernamein interfaceUserSessionModel
-
getIpAddress
Description copied from interface:UserSessionModelNote: will not be an address when a proxy does not provide a valid one- Specified by:
getIpAddressin interfaceUserSessionModel- Returns:
- the ip address
-
getAuthMethod
- Specified by:
getAuthMethodin interfaceUserSessionModel
-
isRememberMe
public boolean isRememberMe()- Specified by:
isRememberMein interfaceUserSessionModel
-
getStarted
public int getStarted()- Specified by:
getStartedin interfaceUserSessionModel
-
getLastSessionRefresh
public int getLastSessionRefresh()- Specified by:
getLastSessionRefreshin interfaceUserSessionModel
-
setLastSessionRefresh
public void setLastSessionRefresh(int lastSessionRefresh) Description copied from interface:UserSessionModelSet 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:
setLastSessionRefreshin interfaceUserSessionModel
-
isOffline
public boolean isOffline()- Specified by:
isOfflinein interfaceUserSessionModel
-
getNote
- Specified by:
getNotein interfaceUserSessionModel
-
setNote
- Specified by:
setNotein interfaceUserSessionModel
-
removeNote
- Specified by:
removeNotein interfaceUserSessionModel
-
getNotes
- Specified by:
getNotesin interfaceUserSessionModel
-
getState
- Specified by:
getStatein interfaceUserSessionModel
-
setState
- Specified by:
setStatein interfaceUserSessionModel
-
getPersistenceState
- Specified by:
getPersistenceStatein interfaceUserSessionModel- Returns:
- Persistence state of the session
-
setPersistenceState
-
restartSession
public void restartSession(RealmModel realm, UserModel user, String loginUsername, String ipAddress, String authMethod, boolean rememberMe, String brokerSessionId, String brokerUserId) - Specified by:
restartSessionin interfaceUserSessionModel
-
equals
-
hashCode
public int hashCode() -
getEntity
-