|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.restlet.Uniform
org.restlet.Restlet
org.restlet.Filter
org.restlet.Guard
public class Guard
Filter guarding the access to an attached Restlet.
Constructor Summary | |
---|---|
Guard(Context context,
ChallengeScheme scheme,
String realm)
Constructor. |
Method Summary | |
---|---|
void |
accept(Request request,
Response response)
Accepts the call. |
int |
authenticate(Request request)
Indicates if the call is properly authenticated. |
boolean |
authorize(Request request)
Indicates if the request is authorized to pass through the Guard. |
void |
challenge(Response response)
Challenges the client by adding a challenge request to the response and by setting the status to CLIENT_ERROR_UNAUTHORIZED. |
protected boolean |
checkSecret(String identifier,
char[] secret)
Indicates if the secret is valid for the given identifier. |
void |
doHandle(Request request,
Response response)
Handles the call by distributing it to the next Restlet. |
protected char[] |
findSecret(String identifier)
Finds the secret associated to a given identifier. |
void |
forbid(Response response)
Rejects the call due to a failed authentication or authorization. |
Map<String,char[]> |
getSecrets()
Returns the map of identifiers and secrets. |
Methods inherited from class org.restlet.Filter |
---|
afterHandle, beforeHandle, getNext, handle, hasNext, setNext, setNext |
Methods inherited from class org.restlet.Restlet |
---|
getContext, getLogger, init, isStarted, isStopped, setContext, start, stop |
Methods inherited from class org.restlet.Uniform |
---|
delete, delete, get, get, handle, head, head, options, options, post, post, put, put |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Guard(Context context, ChallengeScheme scheme, String realm)
context
- The context.scheme
- The authentication scheme to use.realm
- The authentication realm.Method Detail |
---|
public void accept(Request request, Response response)
request
- The request to accept.response
- The response to accept.public int authenticate(Request request)
request
- The request to authenticate.
checkSecret(String, char[])
protected boolean checkSecret(String identifier, char[] secret)
identifier
- the identifiersecret
- the identifier's secret
public boolean authorize(Request request)
request
- The request to authorize.
public void challenge(Response response)
response
- The response to update.public void doHandle(Request request, Response response)
doHandle
in class Filter
request
- The request to handle.response
- The response to update.protected char[] findSecret(String identifier)
identifier
- The identifier to lookup.
public void forbid(Response response)
response
- The reject response.public Map<String,char[]> getSecrets()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |