Class HandlerAuthenticator
java.lang.Object
ch.tocco.nice2.security.impl.auth.HandlerAuthenticator
- All Implemented Interfaces:
Authenticator
Strategy of
Authenticator
using a contributed list of AuthenticationHandler
s
that are asked to vote for the passed credentials.
If authentication fails for all AuthenticationHandler
s an exception is thrown to
indicate authentication failure. If the state ImmutableChallenge.State.SUCCESS
results after
all AuthenticationHandler
s have been asked, the principal is returned that was
set by one of the AuthenticationHandler
s ("last one wins").
The state ImmutableChallenge.State.CANCELLED
is used to immediately abort the authentication
process throwing an AuthenticationCancelledException
.-
Constructor Summary
ConstructorDescriptionHandlerAuthenticator
(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 suppliedCredentials
s.void
setAuthenticationHandlers
(List<AuthenticationHandler> authenticationHandlers) void
setCredentials
(List<Credentials> credentials, Credentials newCredentials) Sets new credentials for the principal that is retrieved from the list of credentials.void
setLoginFailureDelayMinimumInMs
(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:Authenticator
Attempts to authenticates a subject using the supplied
Credentials
s. If authentication is successful a fully populatedPrincipal
is 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:
authenticate
in 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:Authenticator
Sets new credentials for the principal that is retrieved from the list of credentials.- Specified by:
setCredentials
in 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)
-