com.noelios.restlet.util
Class SecurityUtils

java.lang.Object
  extended by com.noelios.restlet.util.SecurityUtils

public class SecurityUtils
extends Object

Security data manipulation utilities.

Author:
Jerome Louvel (contact@noelios.com)

Constructor Summary
SecurityUtils()
           
 
Method Summary
static String format(ChallengeRequest request)
          Formats a challenge request as a HTTP header value.
static String format(ChallengeResponse challenge, Request request, Series<Parameter> httpHeaders)
          Formats a challenge response as raw credentials.
static ChallengeRequest parseRequest(String header)
          Parses an authenticate header into a challenge request.
static ChallengeResponse parseResponse(Request request, Logger logger, String header)
          Parses an authorization header into a challenge response.
static byte[] toHMac(String source, String secretKey)
          Converts a source string to its HMAC/SHA-1 value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SecurityUtils

public SecurityUtils()
Method Detail

format

public static String format(ChallengeRequest request)
Formats a challenge request as a HTTP header value.

Parameters:
request - The challenge request to format.
Returns:
The authenticate header value.

format

public static String format(ChallengeResponse challenge,
                            Request request,
                            Series<Parameter> httpHeaders)
Formats a challenge response as raw credentials.

Parameters:
challenge - The challenge response to format.
request - The parent request.
httpHeaders - The current request HTTP headers.
Returns:
The authorization header value.

parseRequest

public static ChallengeRequest parseRequest(String header)
Parses an authenticate header into a challenge request.

Parameters:
header - The HTTP header value to parse.
Returns:
The parsed challenge request.

parseResponse

public static ChallengeResponse parseResponse(Request request,
                                              Logger logger,
                                              String header)
Parses an authorization header into a challenge response.

Parameters:
request - The request.
logger - The logger to use.
header - The header value to parse.
Returns:
The parsed challenge response.

toHMac

public static byte[] toHMac(String source,
                            String secretKey)
Converts a source string to its HMAC/SHA-1 value.

Parameters:
source - The source string to convert.
secretKey - The secret key to use for conversion.
Returns:
The HMac value of the source string.


Copyright © 2005-2007 Noelios Technologies.