@Immutable public final class HttpDigestAuth extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
ALGORITHM_MD5 |
static String |
ALGORITHM_MD5_SESS |
static String |
DEFAULT_ALGORITHM |
static String |
DEFAULT_QOP |
static String |
HEADER_VALUE_PREFIX_DIGEST |
static String |
QOP_AUTH |
static String |
QOP_AUTH_INT |
| Modifier and Type | Method and Description |
|---|---|
static DigestAuthClientCredentials |
createDigestAuthClientCredentials(com.helger.commons.http.EHttpMethod eMethod,
String sDigestURI,
String sUserName,
String sPassword,
String sRealm,
String sServerNonce,
String sAlgorithm,
String sClientNonce,
String sOpaque,
String sMessageQOP,
int nNonceCount)
Create HTTP Digest auth credentials for a client
|
static DigestAuthClientCredentials |
getDigestAuthClientCredentials(String sAuthHeader)
Get the Digest authentication credentials from the passed HTTP header
value.
|
static com.helger.commons.collection.impl.ICommonsOrderedMap<String,String> |
getDigestAuthParams(String sAuthHeader)
Get the parameters of a Digest authentication string.
|
static String |
getNonceCountString(int nNonceCount) |
public static final String HEADER_VALUE_PREFIX_DIGEST
public static final String ALGORITHM_MD5
public static final String ALGORITHM_MD5_SESS
public static final String DEFAULT_ALGORITHM
public static final String QOP_AUTH
public static final String QOP_AUTH_INT
public static final String DEFAULT_QOP
@Nullable public static com.helger.commons.collection.impl.ICommonsOrderedMap<String,String> getDigestAuthParams(@Nullable String sAuthHeader)
sAuthHeader - The HTTP header value to be interpreted. May be null.null if the passed value cannot be parsed as a HTTP
Digest Authentication value, a ICommonsOrderedMap with all
parameter name-value pairs in the order they are contained.@Nullable public static DigestAuthClientCredentials getDigestAuthClientCredentials(@Nullable String sAuthHeader)
sAuthHeader - The HTTP header value to be interpreted. May be null.null if the passed value is not a correct HTTP Digest
Authentication header value.@Nullable public static String getNonceCountString(@CheckForSigned int nNonceCount)
@Nonnull public static DigestAuthClientCredentials createDigestAuthClientCredentials(@Nonnull com.helger.commons.http.EHttpMethod eMethod, @Nonnull @Nonempty String sDigestURI, @Nonnull @Nonempty String sUserName, @Nonnull String sPassword, @Nonnull @Nonempty String sRealm, @Nonnull @Nonempty String sServerNonce, @Nullable String sAlgorithm, @Nullable String sClientNonce, @Nullable String sOpaque, @Nullable String sMessageQOP, @CheckForSigned int nNonceCount)
eMethod - The HTTP method of the request. May not be null.sDigestURI - The URI from Request-URI of the Request-Line; duplicated here
because proxies are allowed to change the Request-Line in transit.
May neither be null nor empty.sUserName - User name to use. May neither be null nor empty.sPassword - The user's password. May not be null.sRealm - The realm as provided by the server. May neither be
null nor empty.sServerNonce - The nonce as supplied by the server. May neither be
null nor empty.sAlgorithm - The algorithm as provided by the server. Currently only
ALGORITHM_MD5 and ALGORITHM_MD5_SESS is supported.
If it is null than ALGORITHM_MD5 is used as
default.sClientNonce - The client nonce to be used. Must be present if message QOP is
specified or if algorithm is ALGORITHM_MD5_SESS.sOpaque - The opaque value as supplied by the server. May be null
.sMessageQOP - The message QOP. Currently only QOP_AUTH is supported. If
null is passed, than QOP_AUTH with backward
compatibility handling for RFC 2069 is applied.nNonceCount - This MUST be specified if a qop directive is sent (see above), and
MUST NOT be specified if the server did not send a qop directive in
the WWW-Authenticate header field. The nc-value is the hexadecimal
count of the number of requests (including the current request) that
the client has sent with the nonce value in this request. For
example, in the first request sent in response to a given nonce
value, the client sends "nc=00000001". The purpose of this directive
is to allow the server to detect request replays by maintaining its
own copy of this count - if the same nc-value is seen twice, then
the request is a replay.Copyright © 2016–2019 Philip Helger. All rights reserved.