public abstract class AuthenticatorHelper extends Helper
Constructor and Description |
---|
AuthenticatorHelper(ChallengeScheme challengeScheme,
boolean clientSide,
boolean serverSide)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
authenticate(ChallengeResponse cr,
Request request,
Guard guard)
Deprecated.
See new org.restlet.security package.
|
void |
challenge(Response response,
boolean stale,
Guard guard)
Deprecated.
See new org.restlet.security package.
|
void |
formatRawRequest(ChallengeWriter cw,
ChallengeRequest challenge,
Response response,
Series<Parameter> httpHeaders)
Formats a challenge request as raw credentials.
|
void |
formatRawResponse(ChallengeWriter cw,
ChallengeResponse challenge,
Request request,
Series<Parameter> httpHeaders)
Formats a challenge response as raw credentials.
|
java.lang.String |
formatRequest(ChallengeRequest challenge,
Response response,
Series<Parameter> httpHeaders)
Formats a challenge request as a HTTP header value.
|
java.lang.String |
formatResponse(ChallengeResponse challenge,
Request request,
Series<Parameter> httpHeaders)
Formats a challenge response as a HTTP header value.
|
char[] |
formatSecret(ChallengeResponse challengeResponse,
Request request,
Response response,
java.lang.String identifier,
char[] baseSecret,
java.lang.String baseSecretAlgorithm)
Formats the secret of a challenge response.
|
ChallengeScheme |
getChallengeScheme()
Returns the supported challenge scheme.
|
java.util.logging.Logger |
getLogger()
Returns the context's logger.
|
boolean |
isClientSide()
Indicates if client side authentication is supported.
|
boolean |
isServerSide()
Indicates if server side authentication is supported.
|
void |
parseRequest(ChallengeRequest challenge,
Response response,
Series<Parameter> httpHeaders)
Parses an authenticate header into a challenge request.
|
void |
parseResponse(ChallengeResponse challenge,
Request request,
Series<Parameter> httpHeaders)
Parses an authorization header into a challenge response.
|
void |
setChallengeScheme(ChallengeScheme challengeScheme)
Sets the supported challenge scheme.
|
void |
setClientSide(boolean clientSide)
Indicates if client side authentication is supported.
|
void |
setServerSide(boolean serverSide)
Indicates if server side authentication is supported.
|
public AuthenticatorHelper(ChallengeScheme challengeScheme, boolean clientSide, boolean serverSide)
challengeScheme
- The supported challenge scheme.clientSide
- Indicates if client side authentication is supported.serverSide
- Indicates if server side authentication is supported.@Deprecated public int authenticate(ChallengeResponse cr, Request request, Guard guard)
cr
- The challenge response in the request.request
- The request to authenticate.guard
- The associated guard to callback.Guard.checkSecret(Request, String, char[])
@Deprecated public void challenge(Response response, boolean stale, Guard guard)
response
- The response to update.stale
- Indicates if the new challenge is due to a stale response.guard
- The associated guard to callback.public void formatRawRequest(ChallengeWriter cw, ChallengeRequest challenge, Response response, Series<Parameter> httpHeaders) throws java.io.IOException
cw
- The header writer to update.challenge
- The challenge request to format.response
- The parent response.httpHeaders
- The current request HTTP headers.java.io.IOException
public void formatRawResponse(ChallengeWriter cw, ChallengeResponse challenge, Request request, Series<Parameter> httpHeaders)
cw
- The header writer to update.challenge
- The challenge response to format.request
- The parent request.httpHeaders
- The current request HTTP headers.public java.lang.String formatRequest(ChallengeRequest challenge, Response response, Series<Parameter> httpHeaders) throws java.io.IOException
HeaderConstants.HEADER_WWW_AUTHENTICATE
. The default
implementation relies on
formatRawRequest(ChallengeWriter, ChallengeRequest, Response, Series)
to append all parameters from ChallengeMessage.getParameters()
.challenge
- The challenge request to format.response
- The parent response.httpHeaders
- The current response HTTP headers.HeaderConstants.HEADER_WWW_AUTHENTICATE
header value.java.io.IOException
public java.lang.String formatResponse(ChallengeResponse challenge, Request request, Series<Parameter> httpHeaders)
HeaderConstants.HEADER_AUTHORIZATION
. The default implementation
relies on
formatRawResponse(ChallengeWriter, ChallengeResponse, Request, Series)
unless some custom credentials are provided viachallenge
- The challenge response to format.request
- The parent request.httpHeaders
- The current request HTTP headers.HeaderConstants.HEADER_AUTHORIZATION
header value.public char[] formatSecret(ChallengeResponse challengeResponse, Request request, Response response, java.lang.String identifier, char[] baseSecret, java.lang.String baseSecretAlgorithm)
challengeResponse
- The challenge response.request
- The request if available.response
- The response if available.identifier
- The identifier.baseSecret
- The base secret used to compute the secret.baseSecretAlgorithm
- The digest algorithm of the base secret (@see Digest
class).public ChallengeScheme getChallengeScheme()
public java.util.logging.Logger getLogger()
public boolean isClientSide()
public boolean isServerSide()
public void parseRequest(ChallengeRequest challenge, Response response, Series<Parameter> httpHeaders)
HeaderConstants.HEADER_WWW_AUTHENTICATE
.challenge
- The challenge request to update.response
- The parent response.httpHeaders
- The current response HTTP headers.public void parseResponse(ChallengeResponse challenge, Request request, Series<Parameter> httpHeaders)
HeaderConstants.HEADER_AUTHORIZATION
.challenge
- The challenge response to update.request
- The parent request.httpHeaders
- The current request HTTP headers.public void setChallengeScheme(ChallengeScheme challengeScheme)
challengeScheme
- The supported challenge scheme.public void setClientSide(boolean clientSide)
clientSide
- True if client side authentication is supported.public void setServerSide(boolean serverSide)
serverSide
- True if server side authentication is supported.Copyright © 2005-2012. All Rights Reserved.