Class AuthenticatorHelper

    • Field Detail

      • challengeScheme

        private volatile ChallengeScheme challengeScheme
        The supported challenge scheme.
      • clientSide

        private volatile boolean clientSide
        Indicates if client side authentication is supported.
      • serverSide

        private volatile boolean serverSide
        Indicates if server side authentication is supported.
    • Constructor Detail

      • AuthenticatorHelper

        public AuthenticatorHelper​(ChallengeScheme challengeScheme,
                                   boolean clientSide,
                                   boolean serverSide)
        Constructor.
        Parameters:
        challengeScheme - The supported challenge scheme.
        clientSide - Indicates if client side authentication is supported.
        serverSide - Indicates if server side authentication is supported.
    • Method Detail

      • formatRequest

        public void formatRequest​(ChallengeWriter cw,
                                  ChallengeRequest challenge,
                                  Response response,
                                  Series<Header> httpHeaders)
                           throws java.io.IOException
        Formats a challenge request as raw credentials.
        Parameters:
        cw - The header writer to update.
        challenge - The challenge request to format.
        response - The parent response.
        httpHeaders - The current request HTTP headers.
        Throws:
        java.io.IOException
      • formatResponse

        public void formatResponse​(ChallengeWriter cw,
                                   ChallengeResponse challenge,
                                   Request request,
                                   Series<Header> httpHeaders)
        Formats a challenge response as raw credentials.
        Parameters:
        cw - The header writer to update.
        challenge - The challenge response to format.
        request - The parent request.
        httpHeaders - The current request HTTP headers.
      • getChallengeScheme

        public ChallengeScheme getChallengeScheme()
        Returns the supported challenge scheme.
        Returns:
        The supported challenge scheme.
      • getLogger

        public java.util.logging.Logger getLogger()
        Returns the context's logger.
        Returns:
        The context's logger.
      • isClientSide

        public boolean isClientSide()
        Indicates if client side authentication is supported.
        Returns:
        True if client side authentication is supported.
      • isServerSide

        public boolean isServerSide()
        Indicates if server side authentication is supported.
        Returns:
        True if server side authentication is supported.
      • parseResponse

        public void parseResponse​(ChallengeResponse challenge,
                                  Request request,
                                  Series<Header> httpHeaders)
        Parses an authorization header into a challenge response. The header is HeaderConstants.HEADER_AUTHORIZATION.
        Parameters:
        challenge - The challenge response to update.
        request - The parent request.
        httpHeaders - The current request HTTP headers.
      • setChallengeScheme

        public void setChallengeScheme​(ChallengeScheme challengeScheme)
        Sets the supported challenge scheme.
        Parameters:
        challengeScheme - The supported challenge scheme.
      • setClientSide

        public void setClientSide​(boolean clientSide)
        Indicates if client side authentication is supported.
        Parameters:
        clientSide - True if client side authentication is supported.
      • setServerSide

        public void setServerSide​(boolean serverSide)
        Indicates if server side authentication is supported.
        Parameters:
        serverSide - True if server side authentication is supported.
      • updateReference

        public Reference updateReference​(Reference resourceRef,
                                         ChallengeResponse challengeResponse,
                                         Request request)
        Optionally updates the request with a challenge response before sending it. This is sometimes useful for authentication schemes that aren't based on the Authorization header but instead on URI query parameters or other headers. By default it returns the resource URI reference unchanged.
        Parameters:
        resourceRef - The resource URI reference to update.
        challengeResponse - The challenge response provided.
        request - The request to update.
        Returns:
        The original URI reference if unchanged or a new one if updated.