public class DigestChallenge
extends java.lang.Object
WWW-Authenticate
HTTP header.
WWW-Authenticate
headerWWW-Authenticate
response header. The header includes one or more
challenges, some of which may be HTTP Digest challenges.
To parse a HTTP Digest challenge pass it to the parse(String)
method. Note that the
HTTP Digest challenge must first be extracted from the header value if the header contains
multiple challenges, see WwwAuthenticateHeader
.
Modifier and Type | Class and Description |
---|---|
static class |
DigestChallenge.QualityOfProtection
Enumeration of the various types of quality of protection.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAlgorithm()
Returns the value of the algorithm directive if present.
|
java.lang.String |
getDomain()
Returns the unquoted version of the optional domain directive, or
null if the
domain is not set. |
java.lang.String |
getNonce()
Returns the unquoted version of the mandatory nonce directive.
|
java.lang.String |
getOpaque()
Returns the unquoted version of the opaque directive, or
null if the directive
is not present. |
java.lang.String |
getQuotedDomain()
Returns the quoted version of the optional domain directive, exactly as it appears
in the challenge, or
null if the domain is not set. |
java.lang.String |
getQuotedNonce()
Returns the quoted version of the mandatory nonce directive, exactly as it appears
in the challenge.
|
java.lang.String |
getQuotedOpaque()
Returns the quoted version of the opaque directive exactly as it appears in the
challenge, or
null if the directive is not present. |
java.lang.String |
getQuotedRealm()
Returns the quoted version of the mandatory realm directive, exactly as it appears
in the challenge.
|
java.lang.String |
getRealm()
Returns the unquoted version of the mandatory realm directive.
|
java.util.Set<DigestChallenge.QualityOfProtection> |
getSupportedQopTypes()
Returns the types of "quality of protection" listed in the challenge as supported by the
server.
|
static boolean |
isDigestChallenge(java.lang.String challenge)
Returns
true if a string represents a HTTP Digest challenge (which may or may not be
valid). |
boolean |
isStale()
Returns a boolean representation of the stale directive.
|
static DigestChallenge |
parse(java.lang.String challengeString)
Parses a HTTP Digest challenge.
|
java.lang.String |
toString() |
public static boolean isDigestChallenge(java.lang.String challenge)
true
if a string represents a HTTP Digest challenge (which may or may not be
valid).
This method just checks that the string starts with the HTTP challenge prefix, it does not
verify that the challenge is correct. The prefix identifies the challenge type (basic, digest,
etc.), so if this method returns true
the string is either a valid HTTP digest
challenge or not a valid challenge of any type.
challenge
- the string to checktrue
if the string is a HTTP digest challengepublic static DigestChallenge parse(java.lang.String challengeString) throws ChallengeParseException
challengeString
- the challenge as a stringChallengeParseException
- if the challenge is malformedpublic java.lang.String getQuotedRealm()
public java.lang.String getRealm()
public java.lang.String getQuotedDomain()
null
if the domain is not set.
The domain directive is described in
Section 3.2.1 of RFC 2617:
null
if the challenge does not contain the domain directive.public java.lang.String getDomain()
null
if the
domain is not set.
The domain directive is described in
Section 3.2.1 of RFC 2617:
public java.lang.String getAlgorithm()
null
if the algorithm directive is
not present in the headerpublic java.lang.String getQuotedNonce()
The contents of the nonce are implementation dependent. The quality of the implementation depends on a good choice. […]
The nonce is opaque to the client.
public java.lang.String getNonce()
The contents of the nonce are implementation dependent. The quality of the implementation depends on a good choice. […]
The nonce is opaque to the client.
public java.lang.String getQuotedOpaque()
null
if the directive is not present.
The opaque directive is described in
Section 3.2.1 of RFC 2617:
null
if the
opaque directive is not present in the headerpublic java.lang.String getOpaque()
null
if the directive
is not present.
The opaque directive is described in
Section 3.2.1 of RFC 2617:
null
if the
opaque directive is not present in the headerpublic java.util.Set<DigestChallenge.QualityOfProtection> getSupportedQopTypes()
Only the two standard quality of protection types ("auth" and "auth-int") are included in the result, other non-standard qop types are ignored.
public boolean isStale()
true
if the header has a stale directive that is equal to "true"
(case-insensitive). If there is no stale directive or it has any other value, false
is returned.
The stale directive is described in
Section 3.2.1 of RFC 2617:
true
if a stale directive is present in the header and equal to "true"
(case-insensitive), false
otherwise.public java.lang.String toString()
toString
in class java.lang.Object