Class AuthenticatorHelper

java.lang.Object
org.restlet.engine.Helper
org.restlet.engine.security.AuthenticatorHelper
Direct Known Subclasses:
HttpBasicHelper

public abstract class AuthenticatorHelper extends Helper
Base class for authentication helpers.
Author:
Jerome Louvel
  • Constructor Details

    • 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 Details

    • formatRequest

      public void formatRequest(ChallengeWriter cw, ChallengeRequest challenge, Response response, Series<Header> httpHeaders) throws 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:
      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 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(ChallengeRequest challenge, Response response, Series<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(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.