Class HandlerAuthenticator
java.lang.Object
ch.tocco.nice2.security.impl.auth.HandlerAuthenticator
- All Implemented Interfaces:
Authenticator
Strategy of
Authenticator using a contributed list of AuthenticationHandlers
that are asked to vote for the passed credentials.
If authentication fails for all AuthenticationHandlers an exception is thrown to
indicate authentication failure. If the state ImmutableChallenge.State.SUCCESS results after
all AuthenticationHandlers have been asked, the principal is returned that was
set by one of the AuthenticationHandlers ("last one wins").
The state ImmutableChallenge.State.CANCELLED is used to immediately abort the authentication
process throwing an AuthenticationCancelledException.-
Constructor Summary
ConstructorsConstructorDescriptionHandlerAuthenticator(org.slf4j.Logger log, org.springframework.context.ApplicationEventPublisher eventPublisher) -
Method Summary
Modifier and TypeMethodDescriptionauthenticate(List<Credentials> credentials, @Nullable String requestUri) Attempts to authenticates a subject using the suppliedCredentialss.voidsetAuthenticationHandlers(List<AuthenticationHandler> authenticationHandlers) voidsetCredentials(List<Credentials> credentials, Credentials newCredentials) Sets new credentials for the principal that is retrieved from the list of credentials.voidsetLoginFailureDelayMinimumInMs(int loginFailureDelayMinimumInMs)
-
Constructor Details
-
HandlerAuthenticator
public HandlerAuthenticator(org.slf4j.Logger log, org.springframework.context.ApplicationEventPublisher eventPublisher)
-
-
Method Details
-
setLoginFailureDelayMinimumInMs
@Value("${security.loginFailureDelayMinimumInMs}") public void setLoginFailureDelayMinimumInMs(int loginFailureDelayMinimumInMs) -
authenticate
public AuthenticationResult authenticate(List<Credentials> credentials, @Nullable @Nullable String requestUri) throws AuthenticationFailedException Description copied from interface:AuthenticatorAttempts to authenticates a subject using the supplied
Credentialss. If authentication is successful a fully populatedPrincipalis returned (with all authorized roles).If authentication fails an exception is thrown which may hold more information about the cause. This may be used to inform the user about locked accounts or expired passwords, but may not be populated at all.
- Specified by:
authenticatein interfaceAuthenticator- Parameters:
credentials- credentials to authenticate- Throws:
AuthenticationFailedException- if authentication failed due to internal error
-
setCredentials
public void setCredentials(List<Credentials> credentials, Credentials newCredentials) throws UnsupportedCredentialSetException Description copied from interface:AuthenticatorSets new credentials for the principal that is retrieved from the list of credentials.- Specified by:
setCredentialsin interfaceAuthenticator- Parameters:
credentials- old credentials for retrieving the principalnewCredentials- the new credentials to set- Throws:
UnsupportedCredentialSetException- if the underlying authentication strategy does not support setting new credentials (a fingerprint reader for example).
-
setAuthenticationHandlers
@Autowired public void setAuthenticationHandlers(List<AuthenticationHandler> authenticationHandlers)
-