org.restlet.security
Class MethodAuthorizer

java.lang.Object
  extended by org.restlet.Restlet
      extended by org.restlet.routing.Filter
          extended by org.restlet.security.Authorizer
              extended by org.restlet.security.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

Field Summary
 
Fields inherited from class org.restlet.security.Authorizer
ALWAYS, AUTHENTICATED, NEVER
 
Fields inherited from class org.restlet.routing.Filter
CONTINUE, SKIP, STOP
 
Constructor Summary
MethodAuthorizer()
          Default constructor.
MethodAuthorizer(String identifier)
          Constructor.
 
Method Summary
 boolean authorize(Request request, Response response)
          Authorizes the request only if its method is one of the authorized methods.
 List<Method> getAnonymousMethods()
          Returns the modifiable list of methods authorized for anonymous users.
 List<Method> getAuthenticatedMethods()
          Returns the modifiable list of methods authorized for authenticated users.
 void setAnonymousMethods(List<Method> anonymousMethods)
          Sets the modifiable list of methods authorized for anonymous users.
 void setAuthenticatedMethods(List<Method> authenticatedMethods)
          Sets the modifiable list of methods authorized for authenticated users.
 
Methods inherited from class org.restlet.security.Authorizer
authorized, beforeHandle, getIdentifier, setIdentifier, unauthorized
 
Methods inherited from class org.restlet.routing.Filter
afterHandle, doHandle, getNext, handle, hasNext, setNext, setNext, start, stop
 
Methods inherited from class org.restlet.Restlet
createFinder, finalize, getApplication, getAuthor, getContext, getDescription, getFinderClass, getLogger, getName, getOwner, handle, handle, handle, isStarted, isStopped, setAuthor, setContext, setDescription, setFinderClass, setName, setOwner
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodAuthorizer

public MethodAuthorizer()
Default constructor.


MethodAuthorizer

public MethodAuthorizer(String identifier)
Constructor.

Parameters:
identifier - The identifier unique within an application.
Method Detail

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.


Copyright © 2005-2013 Restlet.