Class AuthenticatorHelper

    • Constructor Summary

      Constructors 
      Constructor Description
      AuthenticatorHelper​(org.restlet.data.ChallengeScheme challengeScheme, boolean clientSide, boolean serverSide)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void formatRequest​(ChallengeWriter cw, org.restlet.data.ChallengeRequest challenge, org.restlet.Response response, org.restlet.util.Series<org.restlet.data.Header> httpHeaders)
      Formats a challenge request as raw credentials.
      void formatResponse​(ChallengeWriter cw, org.restlet.data.ChallengeResponse challenge, org.restlet.Request request, org.restlet.util.Series<org.restlet.data.Header> httpHeaders)
      Formats a challenge response as raw credentials.
      org.restlet.data.ChallengeScheme getChallengeScheme()
      Returns the supported challenge scheme.
      java.util.logging.Logger getLogger()
      Returns the context's logger.
      boolean isClientSide()
      Indicates if client side authentication is supported.
      boolean isServerSide()
      Indicates if server side authentication is supported.
      void parseRequest​(org.restlet.data.ChallengeRequest challenge, org.restlet.Response response, org.restlet.util.Series<org.restlet.data.Header> httpHeaders)
      Parses an authenticate header into a challenge request.
      void parseResponse​(org.restlet.data.ChallengeResponse challenge, org.restlet.Request request, org.restlet.util.Series<org.restlet.data.Header> httpHeaders)
      Parses an authorization header into a challenge response.
      void setChallengeScheme​(org.restlet.data.ChallengeScheme challengeScheme)
      Sets the supported challenge scheme.
      void setClientSide​(boolean clientSide)
      Indicates if client side authentication is supported.
      void setServerSide​(boolean serverSide)
      Indicates if server side authentication is supported.
      org.restlet.data.Reference updateReference​(org.restlet.data.Reference resourceRef, org.restlet.data.ChallengeResponse challengeResponse, org.restlet.Request request)
      Optionally updates the request with a challenge response before sending it.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AuthenticatorHelper

        public AuthenticatorHelper​(org.restlet.data.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,
                                  org.restlet.data.ChallengeRequest challenge,
                                  org.restlet.Response response,
                                  org.restlet.util.Series<org.restlet.data.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,
                                   org.restlet.data.ChallengeResponse challenge,
                                   org.restlet.Request request,
                                   org.restlet.util.Series<org.restlet.data.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 org.restlet.data.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.
      • parseRequest

        public void parseRequest​(org.restlet.data.ChallengeRequest challenge,
                                 org.restlet.Response response,
                                 org.restlet.util.Series<org.restlet.data.Header> httpHeaders)
        Parses an authenticate header into a challenge request. The header is HeaderConstants.HEADER_WWW_AUTHENTICATE.
        Parameters:
        challenge - The challenge request to update.
        response - The parent response.
        httpHeaders - The current response HTTP headers.
      • parseResponse

        public void parseResponse​(org.restlet.data.ChallengeResponse challenge,
                                  org.restlet.Request request,
                                  org.restlet.util.Series<org.restlet.data.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​(org.restlet.data.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 org.restlet.data.Reference updateReference​(org.restlet.data.Reference resourceRef,
                                                          org.restlet.data.ChallengeResponse challengeResponse,
                                                          org.restlet.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.