com.noelios.restlet.authentication
Class HttpDigestHelper

java.lang.Object
  extended by com.noelios.restlet.authentication.AuthenticationHelper
      extended by com.noelios.restlet.authentication.HttpDigestHelper

public class HttpDigestHelper
extends AuthenticationHelper

Implements the HTTP DIGEST authentication.

Author:
Jerome Louvel

Constructor Summary
HttpDigestHelper()
          Constructor.
 
Method Summary
 int authenticate(ChallengeResponse cr, Request request, Guard guard)
          Indicates if the call is properly authenticated.
 void challenge(Response response, boolean stale, Guard guard)
          Challenges the client by adding a challenge request to the response and by setting the status to CLIENT_ERROR_UNAUTHORIZED.
 void formatCredentials(java.lang.StringBuilder sb, ChallengeResponse challenge, Request request, Series<Parameter> httpHeaders)
          Formats a challenge response as raw credentials.
 void formatParameters(java.lang.StringBuilder sb, Series<Parameter> parameters, ChallengeRequest request)
          Formats the parameters of a challenge request, to be appended to the scheme technical name and realm.
 void parseResponse(ChallengeResponse cr, Request request)
          Parses an authorization header into a challenge response.
 
Methods inherited from class com.noelios.restlet.authentication.AuthenticationHelper
format, format, getChallengeScheme, getLogger, isClientSide, isServerSide, parseRequest, setChallengeScheme, setClientSide, setServerSide
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpDigestHelper

public HttpDigestHelper()
Constructor.

Method Detail

authenticate

public int authenticate(ChallengeResponse cr,
                        Request request,
                        Guard guard)
Description copied from class: AuthenticationHelper
Indicates if the call is properly authenticated. You are guaranteed that the request has a challenge response with a scheme matching the one supported by the plugin.

Overrides:
authenticate in class AuthenticationHelper
Parameters:
cr - The challenge response in the request.
request - The request to authenticate.
guard - The associated guard to callback.
Returns:
-1 if the given credentials were invalid, 0 if no credentials were found and 1 otherwise.
See Also:
Guard.checkSecret(Request, String, char[])

challenge

public void challenge(Response response,
                      boolean stale,
                      Guard guard)
Description copied from class: AuthenticationHelper
Challenges the client by adding a challenge request to the response and by setting the status to CLIENT_ERROR_UNAUTHORIZED.

Overrides:
challenge in class AuthenticationHelper
Parameters:
response - The response to update.
stale - Indicates if the new challenge is due to a stale response.
guard - The associated guard to callback.

formatCredentials

public void formatCredentials(java.lang.StringBuilder sb,
                              ChallengeResponse challenge,
                              Request request,
                              Series<Parameter> httpHeaders)
Description copied from class: AuthenticationHelper
Formats a challenge response as raw credentials.

Specified by:
formatCredentials in class AuthenticationHelper
Parameters:
sb - The String builder to update.
challenge - The challenge response to format.
request - The parent request.
httpHeaders - The current request HTTP headers.

formatParameters

public void formatParameters(java.lang.StringBuilder sb,
                             Series<Parameter> parameters,
                             ChallengeRequest request)
Description copied from class: AuthenticationHelper
Formats the parameters of a challenge request, to be appended to the scheme technical name and realm.

Overrides:
formatParameters in class AuthenticationHelper
Parameters:
sb - The string builder to update.
parameters - The parameters to format.
request - The challenger request.

parseResponse

public void parseResponse(ChallengeResponse cr,
                          Request request)
Description copied from class: AuthenticationHelper
Parses an authorization header into a challenge response.

Overrides:
parseResponse in class AuthenticationHelper
request - The request.


Copyright © 2005-2008 Noelios Technologies.