Interface Authentication
-
@ProviderType public interface Authentication
TheAuthentication
interface defines methods to validateCredentials
during thelogin 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 theCredentials
.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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
authenticate(@Nullable Credentials credentials)
Validates the specifiedCredentials
and returnstrue
if the validation was successful.@Nullable java.lang.String
getUserId()
Optional method that return the userID extracted uponauthenticate(Credentials)
.@Nullable java.security.Principal
getUserPrincipal()
Optional method that return thePrincipal
of the authenticating user extracted uponauthenticate(Credentials)
.
-
-
-
Method Detail
-
authenticate
boolean authenticate(@Nullable @Nullable Credentials credentials) throws javax.security.auth.login.LoginException
Validates the specifiedCredentials
and returnstrue
if the validation was successful.- Parameters:
credentials
- to verify- Returns:
true
if the validation was successful;false
if the specified credentials are not supported and this authentication implementation cannot verify their validity.- Throws:
javax.security.auth.login.LoginException
- if the authentication failed.
-
getUserId
@Nullable @Nullable java.lang.String getUserId()
Optional method that return the userID extracted uponauthenticate(Credentials)
. It is expected to returnnull
if the implementation doesn't support this. AnIllegalStateException
may be thrown if called prior toauthenticate(Credentials)
.- Returns:
- a user identifier or
null
-
getUserPrincipal
@Nullable @Nullable java.security.Principal getUserPrincipal()
Optional method that return thePrincipal
of the authenticating user extracted uponauthenticate(Credentials)
. It is expected to returnnull
if the implementation doesn't support this. AnIllegalStateException
may be thrown if called prior toauthenticate(Credentials)
.- Returns:
- a valid
Principal
ornull
-
-