public class AuthenticatorUtils extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
anyNull(Object... objects)
Indicates if any of the objects is null.
|
static String |
formatAuthenticationInfo(AuthenticationInfo info)
Formats an authentication information as a HTTP header value.
|
static String |
formatNonceCount(int nonceCount)
Formats a given nonce count as a HTTP header value.
|
static String |
formatRequest(ChallengeRequest challenge,
Response response,
Series<Header> httpHeaders)
Formats a challenge request as a HTTP header value.
|
static String |
formatResponse(ChallengeResponse challenge,
Request request,
Series<Header> httpHeaders)
Formats a challenge response as a HTTP header value.
|
static AuthenticationInfo |
parseAuthenticationInfo(String header)
Parses the "Authentication-Info" header.
|
static List<ChallengeRequest> |
parseRequest(Response response,
String header,
Series<Header> httpHeaders)
Parses an authenticate header into a list of challenge request.
|
static ChallengeResponse |
parseResponse(Request request,
String header,
Series<Header> httpHeaders)
Parses an authorization header into a challenge response.
|
static void |
update(ChallengeResponse challengeResponse,
Request request,
Response response)
Updates a
ChallengeResponse object according to given request and
response. |
static Reference |
updateReference(Reference resourceRef,
ChallengeResponse challengeResponse,
Request request)
Optionally updates the request with a challenge response before sending
it.
|
public static boolean anyNull(Object... objects)
objects
- The objects to test.public static String formatAuthenticationInfo(AuthenticationInfo info)
HeaderConstants.HEADER_AUTHENTICATION_INFO
.info
- The authentication information to format.HeaderConstants.HEADER_AUTHENTICATION_INFO
header
value.public static String formatNonceCount(int nonceCount)
HeaderConstants.HEADER_AUTHENTICATION_INFO
.nonceCount
- The given nonce count.public static String formatRequest(ChallengeRequest challenge, Response response, Series<Header> httpHeaders)
HeaderConstants.HEADER_WWW_AUTHENTICATE
. The default
implementation relies on
#formatRequest(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.public static String formatResponse(ChallengeResponse challenge, Request request, Series<Header> httpHeaders)
HeaderConstants.HEADER_AUTHORIZATION
. The default implementation
relies on
#formatResponse(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.IOException
public static AuthenticationInfo parseAuthenticationInfo(String header)
header
- The header value to parse.AuthenticationInfo
instance.IOException
public static List<ChallengeRequest> parseRequest(Response response, String header, Series<Header> httpHeaders)
HeaderConstants.HEADER_WWW_AUTHENTICATE
.header
- The HTTP header value to parse.httpHeaders
- The current response HTTP headers.public static ChallengeResponse parseResponse(Request request, String header, Series<Header> httpHeaders)
HeaderConstants.HEADER_AUTHORIZATION
.request
- The parent request.header
- The authorization header.httpHeaders
- The current request HTTP headers.public static void update(ChallengeResponse challengeResponse, Request request, Response response)
ChallengeResponse
object according to given request and
response.challengeResponse
- The challengeResponse to update.request
- The request.response
- The response.public static Reference updateReference(Reference resourceRef, ChallengeResponse challengeResponse, Request request)
resourceRef
- The resource URI reference to update.challengeResponse
- The challenge response provided.request
- The request to update.Copyright © 2005–2013. All rights reserved.