Package org.keycloak.sessions
Interface AuthenticationSessionModel
- All Superinterfaces:
CommonClientSessionModel
- All Known Implementing Classes:
AuthenticationSessionAdapter
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 by
RootAuthenticationSessionModel
- Author:
- Marek Posolda
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.keycloak.sessions.CommonClientSessionModel
CommonClientSessionModel.Action, CommonClientSessionModel.ExecutionStatus
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addRequiredAction
(String action) Adds a required action to the authentication session.void
Adds a required action to the authentication session.void
Clears all authentication note.void
Clears all client notes.void
Clears execution status of the authentication session.void
Clears all user session notes.Returns authenticated user that is associated to the authentication session.getAuthNote
(String name) Retrieves value of the given authentication note to the given value.getClientNote
(String name) Retrieves value of the given client note to the given value.Retrieves the (name, value) map of client notes.Gets client scope IDs from the authentication session.Returns execution status of the authentication session.Returns the root authentication session that is parent of this authentication session.Returns required actions (aliases) that are attached to this client session.getTabId()
Retrieves value of given user session note.void
removeAuthNote
(String name) Removes the given authentication note.void
removeClientNote
(String name) Removes the given client note.void
removeRequiredAction
(String action) Removes a required action from the authentication session.void
Removes a required action from the authentication session.void
Sets authenticated user that is associated to the authentication session.void
setAuthNote
(String name, String value) Sets the given authentication note to the given value.void
setClientNote
(String name, String value) Sets the given client note to the given value.void
setClientScopes
(Set<String> clientScopes) Sets client scope IDs to the authentication session.void
setExecutionStatus
(String authenticator, CommonClientSessionModel.ExecutionStatus status) Sets execution status of the authentication session.void
setUserSessionNote
(String name, String value) Sets the given user session note to the given value.Methods inherited from interface org.keycloak.sessions.CommonClientSessionModel
getAction, getClient, getProtocol, getRealm, getRedirectUri, setAction, setProtocol, setRedirectUri
-
Method Details
-
getTabId
String 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()}
-
getParentSession
RootAuthenticationSessionModel getParentSession()Returns the root authentication session that is parent of this authentication session.- Returns:
RootAuthenticationSessionModel
-
getExecutionStatus
Map<String,CommonClientSessionModel.ExecutionStatus> getExecutionStatus()Returns execution status of the authentication session.- Returns:
Map<String, ExecutionStatus>
Never returnsnull
.
-
setExecutionStatus
Sets execution status of the authentication session.- Parameters:
authenticator
-String
Can't benull
.status
-ExecutionStatus
Can't benull
.
-
clearExecutionStatus
void clearExecutionStatus()Clears execution status of the authentication session. -
getAuthenticatedUser
UserModel getAuthenticatedUser()Returns authenticated user that is associated to the authentication session.- Returns:
UserModel
or null if there's no authenticated user.
-
setAuthenticatedUser
Sets authenticated user that is associated to the authentication session.- Parameters:
user
-UserModel
Ifnull
thennull
will be set to the authenticated user.
-
getRequiredActions
Returns required actions (aliases) that are attached to this client session.- Returns:
Set<String>
Never returnsnull
.
-
addRequiredAction
Adds a required action to the authentication session.- Parameters:
action
-String
Can't benull
.
-
removeRequiredAction
Removes a required action from the authentication session.- Parameters:
action
-String
Can't benull
.
-
addRequiredAction
Adds a required action to the authentication session.- Parameters:
action
-UserModel.RequiredAction
Can't benull
.
-
removeRequiredAction
Removes a required action from the authentication session.- Parameters:
action
-UserModel.RequiredAction
Can't benull
.
-
setUserSessionNote
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
-String
Ifnull
is provided the method won't have an effect.value
-String
Ifnull
is provided the method won't have an effect.
-
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 returnsnull
-
clearUserSessionNotes
void 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. -
getAuthNote
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
-String
Ifnull
is provided then the method will returnnull
.- Returns:
String
ornull
if no authentication note is set.
-
setAuthNote
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
-String
Ifnull
is provided the method won't have an effect.value
-String
Ifnull
is provided the method won't have an effect.
-
removeAuthNote
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
-String
Ifnull
is provided the method won't have an effect.
-
clearAuthNotes
void clearAuthNotes()Clears all authentication note. Authentication notes are notes used typically by authenticators and authentication flows. They are cleared when authentication session is restarted. -
getClientNote
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
-String
Ifnull
if provided then the method will returnnull
.- Returns:
String
ornull
if no client's note is set.
-
setClientNote
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
-String
Ifnull
is provided the method won't have an effect.value
-String
Ifnull
is provided the method won't have an effect.
-
removeClientNote
Removes the given client note. Client notes are notes specific to client protocol. They are NOT cleared when authentication session is restarted.- Parameters:
name
-String
Ifnull
is provided the method won't have an effect.
-
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 returnsnull
.
-
clearClientNotes
void clearClientNotes()Clears all client notes. Client notes are notes specific to client protocol. They are NOT cleared when authentication session is restarted. -
getClientScopes
Gets client scope IDs from the authentication session.- Returns:
Set<String>
never returnsnull
.
-
setClientScopes
Sets client scope IDs to the authentication session.- Parameters:
clientScopes
-Set<String>
Can't benull
.
-