Package org.restlet.security
Class MethodAuthorizer
- java.lang.Object
-
- org.restlet.Restlet
-
- org.restlet.routing.Filter
-
- org.restlet.security.Authorizer
-
- 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
-
-
Constructor Summary
Constructors Constructor Description MethodAuthorizer()
Default constructor.MethodAuthorizer(java.lang.String identifier)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
authorize(Request request, Response response)
Authorizes the request only if its method is one of the authorized methods.java.util.List<Method>
getAnonymousMethods()
Returns the modifiable list of methods authorized for anonymous users.java.util.List<Method>
getAuthenticatedMethods()
Returns the modifiable list of methods authorized for authenticated users.void
setAnonymousMethods(java.util.List<Method> anonymousMethods)
Sets the modifiable list of methods authorized for anonymous users.void
setAuthenticatedMethods(java.util.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
-
-
-
-
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 classAuthorizer
- Parameters:
request
- The request sent.response
- The response to update.- Returns:
- True if the authorization succeeded.
-
getAnonymousMethods
public java.util.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 java.util.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(java.util.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(java.util.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.
-
-