Class AuthenticationSessionAdapter
java.lang.Object
org.keycloak.models.sessions.infinispan.AuthenticationSessionAdapter
- All Implemented Interfaces:
AuthenticationSessionModel
,CommonClientSessionModel
NOTE: Calling setter doesn't automatically enlist for update
- Author:
- Marek Posolda
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.keycloak.sessions.CommonClientSessionModel
CommonClientSessionModel.Action, CommonClientSessionModel.ExecutionStatus
-
Constructor Summary
ConstructorDescriptionAuthenticationSessionAdapter
(KeycloakSession session, RootAuthenticationSessionModel parent, SessionEntityUpdater<AuthenticationSessionEntity> updater, String tabId) -
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.boolean
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.getRealm()
Returns required actions (aliases) that are attached to this client session.getTabId()
Retrieves value of given user session note.int
hashCode()
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
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
setProtocol
(String protocol) void
setRedirectUri
(String uri) void
setUserSessionNote
(String name, String value) Sets the given user session note to the given value.
-
Constructor Details
-
AuthenticationSessionAdapter
public AuthenticationSessionAdapter(KeycloakSession session, RootAuthenticationSessionModel parent, SessionEntityUpdater<AuthenticationSessionEntity> updater, String tabId)
-
-
Method Details
-
getTabId
- Specified by:
getTabId
in interfaceAuthenticationSessionModel
- 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
Description copied from interface:AuthenticationSessionModel
Returns the root authentication session that is parent of this authentication session.- Specified by:
getParentSession
in interfaceAuthenticationSessionModel
- Returns:
RootAuthenticationSessionModel
-
getRealm
- Specified by:
getRealm
in interfaceCommonClientSessionModel
-
getClient
- Specified by:
getClient
in interfaceCommonClientSessionModel
-
getRedirectUri
- Specified by:
getRedirectUri
in interfaceCommonClientSessionModel
-
setRedirectUri
- Specified by:
setRedirectUri
in interfaceCommonClientSessionModel
-
getAction
- Specified by:
getAction
in interfaceCommonClientSessionModel
-
setAction
- Specified by:
setAction
in interfaceCommonClientSessionModel
-
getClientScopes
Description copied from interface:AuthenticationSessionModel
Gets client scope IDs from the authentication session.- Specified by:
getClientScopes
in interfaceAuthenticationSessionModel
- Returns:
Set<String>
never returnsnull
.
-
setClientScopes
Description copied from interface:AuthenticationSessionModel
Sets client scope IDs to the authentication session.- Specified by:
setClientScopes
in interfaceAuthenticationSessionModel
- Parameters:
clientScopes
-Set<String>
Can't benull
.
-
getProtocol
- Specified by:
getProtocol
in interfaceCommonClientSessionModel
-
setProtocol
- Specified by:
setProtocol
in interfaceCommonClientSessionModel
-
getClientNote
Description copied from interface:AuthenticationSessionModel
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.- Specified by:
getClientNote
in interfaceAuthenticationSessionModel
- Parameters:
name
-String
Ifnull
if provided then the method will returnnull
.- Returns:
String
ornull
if no client's note is set.
-
setClientNote
Description copied from interface:AuthenticationSessionModel
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.- Specified by:
setClientNote
in interfaceAuthenticationSessionModel
- 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
Description copied from interface:AuthenticationSessionModel
Removes the given client note. Client notes are notes specific to client protocol. They are NOT cleared when authentication session is restarted.- Specified by:
removeClientNote
in interfaceAuthenticationSessionModel
- Parameters:
name
-String
Ifnull
is provided the method won't have an effect.
-
getClientNotes
Description copied from interface:AuthenticationSessionModel
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.- Specified by:
getClientNotes
in interfaceAuthenticationSessionModel
- Returns:
Map<String, String>
never returnsnull
.
-
clearClientNotes
public void clearClientNotes()Description copied from interface:AuthenticationSessionModel
Clears all client notes. Client notes are notes specific to client protocol. They are NOT cleared when authentication session is restarted.- Specified by:
clearClientNotes
in interfaceAuthenticationSessionModel
-
getAuthNote
Description copied from interface:AuthenticationSessionModel
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.- Specified by:
getAuthNote
in interfaceAuthenticationSessionModel
- Parameters:
name
-String
Ifnull
is provided then the method will returnnull
.- Returns:
String
ornull
if no authentication note is set.
-
setAuthNote
Description copied from interface:AuthenticationSessionModel
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.- Specified by:
setAuthNote
in interfaceAuthenticationSessionModel
- 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
Description copied from interface:AuthenticationSessionModel
Removes the given authentication note. Authentication notes are notes used typically by authenticators and authentication flows. They are cleared when authentication session is restarted.- Specified by:
removeAuthNote
in interfaceAuthenticationSessionModel
- Parameters:
name
-String
Ifnull
is provided the method won't have an effect.
-
clearAuthNotes
public void clearAuthNotes()Description copied from interface:AuthenticationSessionModel
Clears all authentication note. Authentication notes are notes used typically by authenticators and authentication flows. They are cleared when authentication session is restarted.- Specified by:
clearAuthNotes
in interfaceAuthenticationSessionModel
-
setUserSessionNote
Description copied from interface:AuthenticationSessionModel
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.- Specified by:
setUserSessionNote
in interfaceAuthenticationSessionModel
- 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
Description copied from interface:AuthenticationSessionModel
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.- Specified by:
getUserSessionNotes
in interfaceAuthenticationSessionModel
- Returns:
Map<String, String>
never returnsnull
-
clearUserSessionNotes
public void clearUserSessionNotes()Description copied from interface:AuthenticationSessionModel
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.- Specified by:
clearUserSessionNotes
in interfaceAuthenticationSessionModel
-
getRequiredActions
Description copied from interface:AuthenticationSessionModel
Returns required actions (aliases) that are attached to this client session.- Specified by:
getRequiredActions
in interfaceAuthenticationSessionModel
- Returns:
Set<String>
Never returnsnull
.
-
addRequiredAction
Description copied from interface:AuthenticationSessionModel
Adds a required action to the authentication session.- Specified by:
addRequiredAction
in interfaceAuthenticationSessionModel
- Parameters:
action
-String
Can't benull
.
-
removeRequiredAction
Description copied from interface:AuthenticationSessionModel
Removes a required action from the authentication session.- Specified by:
removeRequiredAction
in interfaceAuthenticationSessionModel
- Parameters:
action
-String
Can't benull
.
-
addRequiredAction
Description copied from interface:AuthenticationSessionModel
Adds a required action to the authentication session.- Specified by:
addRequiredAction
in interfaceAuthenticationSessionModel
- Parameters:
action
-UserModel.RequiredAction
Can't benull
.
-
removeRequiredAction
Description copied from interface:AuthenticationSessionModel
Removes a required action from the authentication session.- Specified by:
removeRequiredAction
in interfaceAuthenticationSessionModel
- Parameters:
action
-UserModel.RequiredAction
Can't benull
.
-
getExecutionStatus
Description copied from interface:AuthenticationSessionModel
Returns execution status of the authentication session.- Specified by:
getExecutionStatus
in interfaceAuthenticationSessionModel
- Returns:
Map<String, ExecutionStatus>
Never returnsnull
.
-
setExecutionStatus
public void setExecutionStatus(String authenticator, CommonClientSessionModel.ExecutionStatus status) Description copied from interface:AuthenticationSessionModel
Sets execution status of the authentication session.- Specified by:
setExecutionStatus
in interfaceAuthenticationSessionModel
- Parameters:
authenticator
-String
Can't benull
.status
-ExecutionStatus
Can't benull
.
-
clearExecutionStatus
public void clearExecutionStatus()Description copied from interface:AuthenticationSessionModel
Clears execution status of the authentication session.- Specified by:
clearExecutionStatus
in interfaceAuthenticationSessionModel
-
getAuthenticatedUser
Description copied from interface:AuthenticationSessionModel
Returns authenticated user that is associated to the authentication session.- Specified by:
getAuthenticatedUser
in interfaceAuthenticationSessionModel
- Returns:
UserModel
or null if there's no authenticated user.
-
setAuthenticatedUser
Description copied from interface:AuthenticationSessionModel
Sets authenticated user that is associated to the authentication session.- Specified by:
setAuthenticatedUser
in interfaceAuthenticationSessionModel
- Parameters:
user
-UserModel
Ifnull
thennull
will be set to the authenticated user.
-
equals
-
hashCode
public int hashCode()
-