Package org.keycloak.models
Interface UserSessionModel
- All Known Subinterfaces:
- OfflineUserSessionModel
- All Known Implementing Classes:
- PersistentUserSessionAdapter,- UserSessionAdapter,- UserSessionModelDelegate,- UserSessionUpdater
public interface UserSessionModel
- Author:
- Stian Thorgersen
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic enumFlag used when creating user sessionstatic enum
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final StringRepresents the corresponding online/offline user session.
- 
Method SummaryModifier and TypeMethodDescriptiondefault AuthenticatedClientSessionModelgetAuthenticatedClientSessionByClient(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()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 seconds) Set the last session refresh timestamp for the user session.voidvoidsetState(UserSessionModel.State state) 
- 
Field Details- 
CORRESPONDING_SESSION_IDRepresents the corresponding online/offline user session.- See Also:
 
 
- 
- 
Method Details- 
getIdString getId()
- 
getRealmRealmModel getRealm()
- 
getBrokerSessionIdString 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:
 
- 
getBrokerUserIdString getBrokerUserId()
- 
getUserUserModel getUser()
- 
getLoginUsernameString getLoginUsername()
- 
getIpAddressString getIpAddress()Note: will not be an address when a proxy does not provide a valid one- Returns:
- the ip address
 
- 
getAuthMethodString getAuthMethod()
- 
isRememberMeboolean isRememberMe()
- 
getStartedint getStarted()
- 
getLastSessionRefreshint getLastSessionRefresh()
- 
setLastSessionRefreshvoid setLastSessionRefresh(int seconds) 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.
- 
isOfflineboolean isOffline()
- 
getAuthenticatedClientSessionsMap<String,AuthenticatedClientSessionModel> getAuthenticatedClientSessions()Returns 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().
- 
getAuthenticatedClientSessionByClientReturns a client session for the given client UUID.- Returns:
 
- 
removeAuthenticatedClientSessionsRemoves authenticated client sessions for all clients whose UUID is present inremovedClientUUIDSparameter.- Parameters:
- removedClientUUIDS-
 
- 
getNote
- 
setNote
- 
removeNote
- 
getNotes
- 
getStateUserSessionModel.State getState()
- 
setState
- 
restartSession
- 
getPersistenceState- Returns:
- Persistence state of the session
 
 
-