Class MethodAuthorizer

All Implemented Interfaces:
Uniform

public class MethodAuthorizer extends Authorizer
Authorizer based on authorized methods. Note that this authorizer makes the difference between authenticated and anonymous users.
Author:
Jerome Louvel
  • Constructor Details

    • MethodAuthorizer

      public MethodAuthorizer()
      Default constructor.
    • MethodAuthorizer

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

    • authorize

      public boolean authorize(Request request, Response response)
      Authorizes the request only if its method is one of the authorized methods.
      Specified by:
      authorize in class Authorizer
      Parameters:
      request - The request sent.
      response - The response to update.
      Returns:
      True if the authorization succeeded.
    • getAnonymousMethods

      public List<Method> getAnonymousMethods()
      Returns the modifiable list of methods authorized for anonymous users.
      Returns:
      The modifiable list of methods authorized for anonymous users.
    • getAuthenticatedMethods

      public List<Method> getAuthenticatedMethods()
      Returns the modifiable list of methods authorized for authenticated users.
      Returns:
      The modifiable list of methods authorized for authenticated users.
    • setAnonymousMethods

      public void setAnonymousMethods(List<Method> anonymousMethods)
      Sets the modifiable list of methods authorized for anonymous users. This method clears the current list and adds all entries in the parameter list.
      Parameters:
      anonymousMethods - A list of methods authorized for anonymous users.
    • setAuthenticatedMethods

      public void setAuthenticatedMethods(List<Method> authenticatedMethods)
      Sets the modifiable list of methods authorized for authenticated users. This method clears the current list and adds all entries in the parameter list.
      Parameters:
      authenticatedMethods - A list of methods authorized for authenticated users.