Class ClientAuthenticationFailureFactory

  • Direct Known Subclasses:
    OpenAMClientAuthenticationFailureFactory

    public abstract class ClientAuthenticationFailureFactory
    extends Object
    Produces exceptions to handle the invalid_client error of the OAuth2 specification, particularly in handling the error code returned.
    Since:
    13.0.0
    • Constructor Detail

      • ClientAuthenticationFailureFactory

        public ClientAuthenticationFailureFactory()
    • Method Detail

      • getException

        public InvalidClientException getException()
        Produces an InvalidClientException. Used for cases where information about the request is unknown.
        Returns:
        InvalidClientException, an exception reporting that the client cannot be authenticated
      • getException

        public InvalidClientException getException​(String message)
        Produces an InvalidClientException. Used for cases where information about the request is unknown.
        Parameters:
        message - The message which will be reported
        Returns:
        InvalidClientException, an exception reporting that the client cannot be authenticated
      • getException

        public InvalidClientException getException​(OAuth2Request request,
                                                   String message)
        Produces an InvalidClientException or InvalidClientAuthZHeaderException based on the request provided. Establishes which of the two exceptions is appropriate
        Parameters:
        request - The request that has failed to authenticate the user
        message - The message which will be reported
        Returns:
        InvalidClientException or InvalidClientAuthZHeaderException, dependant on if the request uses and authorization header
      • hasAuthorizationHeader

        protected abstract boolean hasAuthorizationHeader​(OAuth2Request request)
        Determines whether the request makes use of the authorization header
        Parameters:
        request - The request to examine
        Returns:
        True if the authorization header is set
      • getRealm

        protected abstract String getRealm​(OAuth2Request request)
        Extracts the realm from the request, and normalises it
        Parameters:
        request - The request to examine
        Returns:
        A normalised realm