public class DigestScheme extends RFC2617Scheme
Since the digest username is included as clear text in the generated Authentication header, the charset of the username must be compatible with the HTTP element charset used by the connection.
Modifier and Type | Field and Description |
---|---|
private String |
a1 |
private String |
a2 |
private String |
cnonce |
private boolean |
complete
Whether the digest authentication process is complete
|
private static char[] |
HEXADECIMAL
Hexa values used when creating 32 character long digest in HTTP DigestScheme
in case of authentication.
|
private String |
lastNonce |
private long |
nounceCount |
private static int |
QOP_AUTH |
private static int |
QOP_AUTH_INT |
private static int |
QOP_MISSING |
private static int |
QOP_UNKNOWN |
private static long |
serialVersionUID |
challengeState
Constructor and Description |
---|
DigestScheme() |
DigestScheme(ChallengeState challengeState)
Deprecated.
(4.3) do not use.
|
DigestScheme(Charset credentialsCharset) |
Modifier and Type | Method and Description |
---|---|
Header |
authenticate(Credentials credentials,
HttpRequest request)
|
Header |
authenticate(Credentials credentials,
HttpRequest request,
HttpContext context)
Produces a digest authorization string for the given set of
Credentials , method name and URI. |
static String |
createCnonce()
Creates a random cnonce value based on the current time.
|
private Header |
createDigestHeader(Credentials credentials,
HttpRequest request)
Creates digest-response header as defined in RFC2617.
|
private static MessageDigest |
createMessageDigest(String digAlg) |
(package private) static String |
encode(byte[] binaryData)
Encodes the 128 bit (16 bytes) MD5 digest into a 32 characters long
String according to RFC 2617. |
(package private) String |
getA1() |
(package private) String |
getA2() |
(package private) String |
getCnonce() |
String |
getSchemeName()
Returns textual designation of the digest authentication scheme.
|
boolean |
isComplete()
Tests if the Digest authentication process has been completed.
|
boolean |
isConnectionBased()
Returns
false . |
void |
overrideParamter(String name,
String value) |
void |
processChallenge(Header header)
Processes the Digest challenge.
|
String |
toString() |
getCredentialsCharset, getCredentialsCharset, getParameter, getParameters, getRealm, parseChallenge
getChallengeState, isProxy
private static final long serialVersionUID
private static final char[] HEXADECIMAL
encode(byte[])
private boolean complete
private static final int QOP_UNKNOWN
private static final int QOP_MISSING
private static final int QOP_AUTH_INT
private static final int QOP_AUTH
private long nounceCount
public DigestScheme(Charset credentialsCharset)
@Deprecated public DigestScheme(ChallengeState challengeState)
DigestScheme
with the given challenge
state.public DigestScheme()
public void processChallenge(Header header) throws MalformedChallengeException
processChallenge
in interface AuthScheme
processChallenge
in class AuthSchemeBase
header
- the challenge headerMalformedChallengeException
- is thrown if the authentication challenge
is malformedpublic boolean isComplete()
true
if Digest authorization has been processed,
false
otherwise.public String getSchemeName()
digest
public boolean isConnectionBased()
false
. Digest authentication scheme is request based.false
.public void overrideParamter(String name, String value)
@Deprecated public Header authenticate(Credentials credentials, HttpRequest request) throws AuthenticationException
ContextAwareAuthScheme.authenticate(
Credentials, HttpRequest, org.apache.http.protocol.HttpContext)
AuthScheme
Credentials
.credentials
- The set of credentials to be used for athenticationrequest
- The request being authenticatedAuthenticationException
- if authorization string cannot
be generated due to an authentication failurepublic Header authenticate(Credentials credentials, HttpRequest request, HttpContext context) throws AuthenticationException
Credentials
, method name and URI.authenticate
in interface ContextAwareAuthScheme
authenticate
in class AuthSchemeBase
credentials
- A set of credentials to be used for athenticationrequest
- The request being authenticatedcontext
- HTTP contextInvalidCredentialsException
- if authentication credentials
are not valid or not applicable for this authentication schemeAuthenticationException
- if authorization string cannot
be generated due to an authentication failureprivate static MessageDigest createMessageDigest(String digAlg) throws UnsupportedDigestAlgorithmException
private Header createDigestHeader(Credentials credentials, HttpRequest request) throws AuthenticationException
credentials
- User credentialsAuthenticationException
static String encode(byte[] binaryData)
String
according to RFC 2617.binaryData
- array containing the digestnull
if encoding failedpublic static String createCnonce()
public String toString()
toString
in class AuthSchemeBase
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses