Interface Authentication
@ProviderType
public interface Authentication
The
Authentication interface defines methods to validate
Credentials during the
login step of the
authentication process. The validation depends on the authentication
mechanism in place.
A given implementation may only handle certain types of Credentials
as the authentication process is tightly coupled to the semantics of the
Credentials.
For example a implementation may only be able to validate UserID/password
pairs such as passed with SimpleCredentials, while another
might be responsible for validating login token issued by the repository or
an external access token generation mechanism.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanauthenticate(@Nullable Credentials credentials) Validates the specifiedCredentialsand returnstrueif the validation was successful.@Nullable StringOptional method that return the userID extracted uponauthenticate(Credentials).@Nullable PrincipalOptional method that return thePrincipalof the authenticating user extracted uponauthenticate(Credentials).
-
Method Details
-
authenticate
Validates the specifiedCredentialsand returnstrueif the validation was successful.- Parameters:
credentials- to verify- Returns:
trueif the validation was successful;falseif the specified credentials are not supported and this authentication implementation cannot verify their validity.- Throws:
LoginException- if the authentication failed.
-
getUserId
Optional method that return the userID extracted uponauthenticate(Credentials). It is expected to returnnullif the implementation doesn't support this. AnIllegalStateExceptionmay be thrown if called prior toauthenticate(Credentials).- Returns:
- a user identifier or
null
-
getUserPrincipal
Optional method that return thePrincipalof the authenticating user extracted uponauthenticate(Credentials). It is expected to returnnullif the implementation doesn't support this. AnIllegalStateExceptionmay be thrown if called prior toauthenticate(Credentials).- Returns:
- a valid
Principalornull
-