Class SessionAuthenticationHandler
- All Implemented Interfaces:
AuthenticationHandler
SessionCredentials
.
It supports setting new credentials of type UserCredentialsChange
.-
Field Summary
Fields inherited from interface ch.tocco.nice2.security.spi.auth.AuthenticationHandler
ANONYMOUS_HANDLER_ORDER, API_KEY_PK_ATTRIBUTE, PRINCIPAL_PK_ATTRIBUTE, SESSION_HASH_HANDLER_ORDER, SESSION_ID_ATTRIBUTE
-
Constructor Summary
ConstructorDescriptionSessionAuthenticationHandler
(org.slf4j.Logger logger, ContextManager contextManager, PrincipalManager principalManager, SessionManager sessionManager, PrincipalService principalService, PersistenceService persistenceService) -
Method Summary
Modifier and TypeMethodDescriptionvoid
authenticate
(Challenge challenge, Credentials credentials) Authenticates the given challenge by voting for or against it.void
postAuthenticate
(Challenge challenge) After authentication has been successful for all registered AuthenticationHandlers, the post-authentication step is invoked to add more authorization information to the principal which is sure to be not null and authenticated when this method is invoked.boolean
updateCredentials
(Credentials oldCredentials, Credentials newCredentials) Updates the credentials for this handler.Methods inherited from class ch.tocco.nice2.security.spi.auth.AuthenticationHandlerAdapter
getName
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ch.tocco.nice2.security.spi.auth.AuthenticationHandler
postEventListeners
-
Field Details
-
SESSION_ATTRIBUTE
- See Also:
-
SESSION_PK_ATTRIBUTE
- See Also:
-
-
Constructor Details
-
SessionAuthenticationHandler
public SessionAuthenticationHandler(org.slf4j.Logger logger, ContextManager contextManager, PrincipalManager principalManager, SessionManager sessionManager, PrincipalService principalService, PersistenceService persistenceService)
-
-
Method Details
-
authenticate
Description copied from interface:AuthenticationHandler
Authenticates the given challenge by voting for or against it.
If the supplied credentials are unknown to this handler, it may not vote at all, indicating no meaningful knowledge about the challenge.
- Specified by:
authenticate
in interfaceAuthenticationHandler
- Overrides:
authenticate
in classAuthenticationHandlerAdapter
- Parameters:
challenge
- the authentication challengecredentials
- the credentials supplied by client in case of non-recoverable error. An exception will immediately stop authentication process to failed state.
-
postAuthenticate
Description copied from interface:AuthenticationHandler
After authentication has been successful for all registered AuthenticationHandlers, the post-authentication step is invoked to add more authorization information to the principal which is sure to be not null and authenticated when this method is invoked.
This handler may also decide in this step to give a new vote for this challenge which overrides the previously given vote.
If this throws any exception, authentication process is immediately stopped to failed state.
- Specified by:
postAuthenticate
in interfaceAuthenticationHandler
- Overrides:
postAuthenticate
in classAuthenticationHandlerAdapter
- Parameters:
challenge
- the challenge to authenticate
-
updateCredentials
Description copied from interface:AuthenticationHandler
Updates the credentials for this handler.If this handler is not supporting this, return
.false
In case of an exception, the whole process is stopped immediately.
- Specified by:
updateCredentials
in interfaceAuthenticationHandler
- Overrides:
updateCredentials
in classAuthenticationHandlerAdapter
- Parameters:
oldCredentials
- the old credentials are used to get the principalnewCredentials
- the new credentials to set. authentication handlers should only support their sepcific type of credentials- Returns:
- true if credentials were updated successfully, false if skipped
-