ChallengeAuthenticator class instead.@Deprecated public class Guard extends Filter
Here are the processing steps of a Guard when a request reaches it:
Status.CLIENT_ERROR_FORBIDDEN (403).| Modifier and Type | Field and Description |
|---|---|
static int |
AUTHENTICATION_INVALID
Deprecated.
Indicates that an authentication response is considered invalid.
|
static int |
AUTHENTICATION_MISSING
Deprecated.
Indicates that an authentication response couldn't be found.
|
static int |
AUTHENTICATION_STALE
Deprecated.
Indicates that an authentication response is stale.
|
static int |
AUTHENTICATION_VALID
Deprecated.
Indicates that an authentication response is valid.
|
static long |
DEFAULT_NONCE_LIFESPAN_MILLIS
Deprecated.
Default lifespan for generated nonces (5 minutes).
|
| Constructor and Description |
|---|
Guard(Context context,
ChallengeScheme scheme,
java.lang.String realm)
Deprecated.
Constructor.
|
Guard(Context context,
java.lang.String realm,
java.util.Collection<java.lang.String> baseUris,
java.lang.String serverKey)
Deprecated.
Alternate Constructor for HTTP DIGEST authentication scheme.
|
| Modifier and Type | Method and Description |
|---|---|
void |
accept(Request request,
Response response)
Deprecated.
Accepts the call.
|
int |
authenticate(Request request)
Deprecated.
Indicates if the call is properly authenticated.
|
boolean |
authorize(Request request)
Deprecated.
Indicates if the request is authorized to pass through the Guard.
|
void |
challenge(Response response,
boolean stale)
Deprecated.
Challenges the client by adding a challenge request to the response and
by setting the status to CLIENT_ERROR_UNAUTHORIZED.
|
boolean |
checkSecret(Request request,
java.lang.String identifier,
char[] secret)
Deprecated.
Indicates if the secret is valid for the given identifier.
|
int |
doHandle(Request request,
Response response)
Deprecated.
Handles the call by distributing it to the next Restlet.
|
char[] |
findSecret(java.lang.String identifier)
Deprecated.
Finds the secret associated to a given identifier.
|
void |
forbid(Response response)
Deprecated.
Rejects the call due to a failed authentication or authorization.
|
java.util.Collection<java.lang.String> |
getDomainUris()
Deprecated.
Returns the base URIs that collectively define the protected domain for
HTTP Digest Authentication.
|
long |
getNonceLifespan()
Deprecated.
Returns the number of milliseconds between each mandatory nonce refresh.
|
java.lang.String |
getRealm()
Deprecated.
Returns the authentication realm.
|
ChallengeScheme |
getScheme()
Deprecated.
Returns the authentication challenge scheme.
|
Resolver<char[]> |
getSecretResolver()
Deprecated.
Returns the secret resolver.
|
java.util.concurrent.ConcurrentMap<java.lang.String,char[]> |
getSecrets()
Deprecated.
Returns the modifiable map of identifiers and secrets.
|
java.lang.String |
getServerKey()
Deprecated.
Returns the secret key known only by server.
|
boolean |
isRechallengeEnabled()
Deprecated.
Indicates if a new challenge should be sent when invalid credentials are
received (true by default to conform to HTTP recommendations).
|
void |
setDomainUris(java.util.Collection<java.lang.String> domainUris)
Deprecated.
Sets the URIs that define the HTTP DIGEST authentication protection
domains.
|
void |
setNonceLifespan(long lifespan)
Deprecated.
Sets the number of milliseconds between each mandatory nonce refresh.
|
void |
setRealm(java.lang.String realm)
Deprecated.
Sets the authentication realm.
|
void |
setRechallengeEnabled(boolean rechallengeEnabled)
Deprecated.
Indicates if a new challenge should be sent when invalid credentials are
received.
|
void |
setScheme(ChallengeScheme scheme)
Deprecated.
Sets the authentication challenge scheme.
|
void |
setSecretResolver(Resolver<char[]> secretResolver)
Deprecated.
Sets the secret resolver.
|
void |
setServerKey(java.lang.String serverKey)
Deprecated.
Sets the secret key known only by server.
|
afterHandle, beforeHandle, getNext, handle, hasNext, setNext, setNext, start, stopfinalize, getApplication, getAuthor, getContext, getDescription, getLogger, getName, getOwner, isStarted, isStopped, setAuthor, setContext, setDescription, setName, setOwnerpublic static final int AUTHENTICATION_INVALID
public static final int AUTHENTICATION_MISSING
public static final int AUTHENTICATION_STALE
public static final int AUTHENTICATION_VALID
public static final long DEFAULT_NONCE_LIFESPAN_MILLIS
public Guard(Context context, ChallengeScheme scheme, java.lang.String realm) throws java.lang.IllegalArgumentException
context - The context.scheme - The authentication scheme to use.realm - The authentication realm.java.lang.IllegalArgumentException - if the scheme is nullpublic Guard(Context context, java.lang.String realm, java.util.Collection<java.lang.String> baseUris, java.lang.String serverKey)
context - contextrealm - authentication realmbaseUris - protection domain as a collection of base URIsserverKey - secret key known only to serverpublic void accept(Request request, Response response)
request - The request to accept.response - The response to accept.public int authenticate(Request request)
ChallengeResponse.setAuthenticated(boolean) and
ClientInfo.setAuthenticated(boolean) methods are always called
after authentication.request - The request to authenticate.checkSecret(Request, String, char[])public boolean authorize(Request request)
request - The request to authorize.public void challenge(Response response, boolean stale)
response - The response to update.stale - Indicates if the new challenge is due to a stale response.public boolean checkSecret(Request request, java.lang.String identifier, char[] secret)
request - The Requestidentifier - the identifiersecret - the identifier's secretpublic int doHandle(Request request, Response response)
public char[] findSecret(java.lang.String identifier)
setSecretResolver(Resolver)
method.identifier - The identifier to lookup.public void forbid(Response response)
response - The reject response.public java.util.Collection<java.lang.String> getDomainUris()
public long getNonceLifespan()
public java.lang.String getRealm()
public ChallengeScheme getScheme()
public Resolver<char[]> getSecretResolver()
public java.util.concurrent.ConcurrentMap<java.lang.String,char[]> getSecrets()
public java.lang.String getServerKey()
public boolean isRechallengeEnabled()
Status.CLIENT_ERROR_FORBIDDEN).public void setDomainUris(java.util.Collection<java.lang.String> domainUris)
domainUris - The URIs of protection domains.public void setNonceLifespan(long lifespan)
lifespan - The nonce lifespan in ms.public void setRealm(java.lang.String realm)
realm - The authentication realm.public void setRechallengeEnabled(boolean rechallengeEnabled)
rechallengeEnabled - True if invalid credentials result in a new challenge.isRechallengeEnabled()public void setScheme(ChallengeScheme scheme)
scheme - The authentication challenge scheme.public void setSecretResolver(Resolver<char[]> secretResolver)
secretResolver - The secret resolver.public void setServerKey(java.lang.String serverKey)
serverKey - The server secret key.Copyright © 2005-2012. All Rights Reserved.