Package ch.tocco.nice2.security.api.auth
Interface Authenticator
- All Known Implementing Classes:
HandlerAuthenticator
public interface Authenticator
This authenticator is the main entry point for authenticating. A client uses this service to authenticate
a subject with any list of credentials.
-
Method Summary
Modifier and TypeMethodDescriptionauthenticate
(List<Credentials> credentials, @Nullable String requestUri) Attempts to authenticates a subject using the suppliedCredentials
s.void
setCredentials
(List<Credentials> credentials, Credentials newCredentials) Sets new credentials for the principal that is retrieved from the list of credentials.
-
Method Details
-
authenticate
AuthenticationResult authenticate(List<Credentials> credentials, @Nullable @Nullable String requestUri) throws AuthenticationFailedException 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.
- Parameters:
credentials
- credentials to authenticate- Throws:
AuthenticationFailedException
- if authentication failed due to internal error
-
setCredentials
void setCredentials(List<Credentials> credentials, Credentials newCredentials) throws UnsupportedCredentialSetException, AuthenticationActionException Sets new credentials for the principal that is retrieved from the list of credentials.- 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).AuthenticationActionException
- in case of any error
-