Package org.keycloak.sessions
Interface AuthenticationSessionModel
- 
- All Superinterfaces:
- CommonClientSessionModel
 - All Known Implementing Classes:
- AuthenticationSessionAdapter,- MapAuthenticationSessionAdapter
 
 public interface AuthenticationSessionModel extends CommonClientSessionModel Represents the state of the authentication. If the login is requested from different tabs of same browser, every browser tab has it's own state of the authentication. So there is separate AuthenticationSessionModel for every tab. Whole browser is represented byRootAuthenticationSessionModel- Author:
- Marek Posolda
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from interface org.keycloak.sessions.CommonClientSessionModelCommonClientSessionModel.Action, CommonClientSessionModel.ExecutionStatus
 
- 
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddRequiredAction(String action)Adds a required action to the authentication session.voidaddRequiredAction(UserModel.RequiredAction action)Adds a required action to the authentication session.voidclearAuthNotes()Clears all authentication note.voidclearClientNotes()Clears all client notes.voidclearExecutionStatus()Clears execution status of the authentication session.voidclearUserSessionNotes()Clears all user session notes.UserModelgetAuthenticatedUser()Returns authenticated user that is associated to the authentication session.StringgetAuthNote(String name)Retrieves value of the given authentication note to the given value.StringgetClientNote(String name)Retrieves value of the given client note to the given value.Map<String,String>getClientNotes()Retrieves the (name, value) map of client notes.Set<String>getClientScopes()Gets client scope IDs from the authentication session.Map<String,CommonClientSessionModel.ExecutionStatus>getExecutionStatus()Returns execution status of the authentication session.RootAuthenticationSessionModelgetParentSession()Returns the root authentication session that is parent of this authentication session.Set<String>getRequiredActions()Returns required actions that are attached to this client session.StringgetTabId()Map<String,String>getUserSessionNotes()Retrieves value of given user session note.voidremoveAuthNote(String name)Removes the given authentication note.voidremoveClientNote(String name)Removes the given client note.voidremoveRequiredAction(String action)Removes a required action from the authentication session.voidremoveRequiredAction(UserModel.RequiredAction action)Removes a required action from the authentication session.voidsetAuthenticatedUser(UserModel user)Sets authenticated user that is associated to the authentication session.voidsetAuthNote(String name, String value)Sets the given authentication note to the given value.voidsetClientNote(String name, String value)Sets the given client note to the given value.voidsetClientScopes(Set<String> clientScopes)Sets client scope IDs to the authentication session.voidsetExecutionStatus(String authenticator, CommonClientSessionModel.ExecutionStatus status)Sets execution status of the authentication session.voidsetUserSessionNote(String name, String value)Sets the given user session note to the given value.- 
Methods inherited from interface org.keycloak.sessions.CommonClientSessionModelgetAction, getClient, getProtocol, getRealm, getRedirectUri, setAction, setProtocol, setRedirectUri
 
- 
 
- 
- 
- 
Method Detail- 
getTabIdString getTabId() - Returns:
- ID of this subsession (in other words, usually browser tab). For lookup the AuthenticationSessionModel, you need: ID of rootSession (parent), client UUID and tabId. For lookup the ID of the parent, use {@link #getParentSession().getId()}
 
 - 
getParentSessionRootAuthenticationSessionModel getParentSession() Returns the root authentication session that is parent of this authentication session.- Returns:
- RootAuthenticationSessionModel
 
 - 
getExecutionStatusMap<String,CommonClientSessionModel.ExecutionStatus> getExecutionStatus() Returns execution status of the authentication session.- Returns:
- Map<String, ExecutionStatus>Never returns- null.
 
 - 
setExecutionStatusvoid setExecutionStatus(String authenticator, CommonClientSessionModel.ExecutionStatus status) Sets execution status of the authentication session.- Parameters:
- authenticator-- StringCan't be- null.
- status-- ExecutionStatusCan't be- null.
 
 - 
clearExecutionStatusvoid clearExecutionStatus() Clears execution status of the authentication session.
 - 
getAuthenticatedUserUserModel getAuthenticatedUser() Returns authenticated user that is associated to the authentication session.- Returns:
- UserModelor null if there's no authenticated user.
 
 - 
setAuthenticatedUservoid setAuthenticatedUser(UserModel user) Sets authenticated user that is associated to the authentication session.- Parameters:
- user-- UserModelIf- nullthen- nullwill be set to the authenticated user.
 
 - 
getRequiredActionsSet<String> getRequiredActions() Returns required actions that are attached to this client session.- Returns:
- Set<String>Never returns- null.
 
 - 
addRequiredActionvoid addRequiredAction(String action) Adds a required action to the authentication session.- Parameters:
- action-- StringCan't be- null.
 
 - 
removeRequiredActionvoid removeRequiredAction(String action) Removes a required action from the authentication session.- Parameters:
- action-- StringCan't be- null.
 
 - 
addRequiredActionvoid addRequiredAction(UserModel.RequiredAction action) Adds a required action to the authentication session.- Parameters:
- action-- UserModel.RequiredActionCan't be- null.
 
 - 
removeRequiredActionvoid removeRequiredAction(UserModel.RequiredAction action) Removes a required action from the authentication session.- Parameters:
- action-- UserModel.RequiredActionCan't be- null.
 
 - 
setUserSessionNotevoid setUserSessionNote(String name, String value) Sets the given user session note to the given value. User session notes are notes you want be applied to the UserSessionModel when the client session is attached to it.- Parameters:
- name-- StringIf- nullis provided the method won't have an effect.
- value-- StringIf- nullis provided the method won't have an effect.
 
 - 
getUserSessionNotesMap<String,String> getUserSessionNotes() Retrieves value of given user session note. User session notes are notes you want be applied to the UserSessionModel when the client session is attached to it.- Returns:
- Map<String, String>never returns- null
 
 - 
clearUserSessionNotesvoid clearUserSessionNotes() Clears all user session notes. User session notes are notes you want be applied to the UserSessionModel when the client session is attached to it.
 - 
getAuthNoteString getAuthNote(String name) Retrieves value of the given authentication note to the given value. Authentication notes are notes used typically by authenticators and authentication flows. They are cleared when authentication session is restarted.- Parameters:
- name-- StringIf- nullis provided then the method will return- null.
- Returns:
- Stringor- nullif no authentication note is set.
 
 - 
setAuthNotevoid setAuthNote(String name, String value) Sets the given authentication note to the given value. Authentication notes are notes used typically by authenticators and authentication flows. They are cleared when authentication session is restarted.- Parameters:
- name-- StringIf- nullis provided the method won't have an effect.
- value-- StringIf- nullis provided the method won't have an effect.
 
 - 
removeAuthNotevoid removeAuthNote(String name) Removes the given authentication note. Authentication notes are notes used typically by authenticators and authentication flows. They are cleared when authentication session is restarted.- Parameters:
- name-- StringIf- nullis provided the method won't have an effect.
 
 - 
clearAuthNotesvoid clearAuthNotes() Clears all authentication note. Authentication notes are notes used typically by authenticators and authentication flows. They are cleared when authentication session is restarted.
 - 
getClientNoteString getClientNote(String name) Retrieves value of the given client note to the given value. Client notes are notes specific to client protocol. They are NOT cleared when authentication session is restarted.- Parameters:
- name-- StringIf- nullif provided then the method will return- null.
- Returns:
- Stringor- nullif no client's note is set.
 
 - 
setClientNotevoid setClientNote(String name, String value) Sets the given client note to the given value. Client notes are notes specific to client protocol. They are NOT cleared when authentication session is restarted.- Parameters:
- name-- StringIf- nullis provided the method won't have an effect.
- value-- StringIf- nullis provided the method won't have an effect.
 
 - 
removeClientNotevoid removeClientNote(String name) Removes the given client note. Client notes are notes specific to client protocol. They are NOT cleared when authentication session is restarted.- Parameters:
- name-- StringIf- nullis provided the method won't have an effect.
 
 - 
getClientNotesMap<String,String> getClientNotes() Retrieves the (name, value) map of client notes. Client notes are notes specific to client protocol. They are NOT cleared when authentication session is restarted.- Returns:
- Map<String, String>never returns- null.
 
 - 
clearClientNotesvoid clearClientNotes() Clears all client notes. Client notes are notes specific to client protocol. They are NOT cleared when authentication session is restarted.
 - 
getClientScopesSet<String> getClientScopes() Gets client scope IDs from the authentication session.- Returns:
- Set<String>never returns- null.
 
 
- 
 
-