Interface Authenticator<C,​P extends Principal>

  • Type Parameters:
    C - the type of credentials the authenticator can authenticate
    P - the type of principals the authenticator returns
    All Known Implementing Classes:
    CachingAuthenticator, ExampleAuthenticator

    public interface Authenticator<C,​P extends Principal>
    An interface for classes which authenticate user-provided credentials and return principal objects.
    • Method Detail

      • authenticate

        Optional<P> authenticate​(C credentials)
                          throws AuthenticationException
        Given a set of user-provided credentials, return an optional principal. If the credentials are valid and map to a principal, returns an Optional.of(Object). If the credentials are invalid, returns an Optional.empty().
        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