Class Authorizer

All Implemented Interfaces:
Uniform
Direct Known Subclasses:
ConfidentialAuthorizer, MethodAuthorizer, RoleAuthorizer

public abstract class Authorizer extends Filter
Filter authorizing inbound request. It can be attached to protect a set of downstream Restlet and ServerResource objects.
Author:
Jerome Louvel
  • Field Details

  • Constructor Details

    • Authorizer

      public Authorizer()
      Default constructor.
    • Authorizer

      public Authorizer(String identifier)
      Constructor.
      Parameters:
      identifier - The identifier unique within an application.
  • Method Details

    • authorize

      protected abstract boolean authorize(Request request, Response response)
      Attempts to authorize the request.
      Parameters:
      request - The request sent.
      response - The response to update.
      Returns:
      True if the authorization succeeded.
    • authorized

      protected int authorized(Request request, Response response)
      Invoked upon successful authorization. Returns Filter.CONTINUE by default.
      Parameters:
      request - The request sent.
      response - The response to update.
      Returns:
      The filter continuation code.
    • beforeHandle

      protected int beforeHandle(Request request, Response response)
      Description copied from class: Filter
      Allows filtering before processing by the next Restlet. Returns Filter.CONTINUE by default.
      Overrides:
      beforeHandle in class Filter
      Parameters:
      request - The request to handle.
      response - The response to update.
      Returns:
      The continuation status. Either Filter.CONTINUE or Filter.SKIP or Filter.STOP.
    • getIdentifier

      public String getIdentifier()
      Returns the identifier unique within an application.
      Returns:
      The identifier unique within an application.
    • setIdentifier

      public void setIdentifier(String identifier)
      Sets the identifier unique within an application.
      Parameters:
      identifier - The identifier unique within an application.
    • unauthorized

      protected int unauthorized(Request request, Response response)
      Invoked upon failed authorization. Sets the status to Status.CLIENT_ERROR_FORBIDDEN and returns Filter.STOP by default.
      Parameters:
      request - The request sent.
      response - The response to update.
      Returns:
      The filter continuation code.