Package com.example.helloworld.auth
Class ExampleAuthenticator
java.lang.Object
com.example.helloworld.auth.ExampleAuthenticator
- All Implemented Interfaces:
Authenticator<BasicCredentials,
User>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionauthenticate
(BasicCredentials credentials) Given a set of user-provided credentials, return an optional principal.
-
Constructor Details
-
ExampleAuthenticator
public ExampleAuthenticator()
-
-
Method Details
-
authenticate
Description copied from interface:Authenticator
Given a set of user-provided credentials, return an optional principal. If the credentials are valid and map to a principal, returns anOptional.of(Object)
. If the credentials are invalid, returns anOptional.empty()
.- Specified by:
authenticate
in interfaceAuthenticator<BasicCredentials,
User> - Parameters:
credentials
- a set of user-provided credentials- Returns:
- either an authenticated principal or an absent optional
- Throws:
AuthenticationException
- if the credentials cannot be authenticated due to an underlying error
-