Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.apache.commons.httpclient.auth.RFC2617Scheme
org.apache.commons.httpclient.auth.DigestScheme
public class DigestScheme
extends RFC2617Scheme
credential
charset
parameter. 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
.
TODO: make class more stateful regarding repeated authentication requests
Constructor Summary | |
| |
|
Method Summary | |
String |
|
String |
|
static String |
|
String |
|
String |
|
boolean |
|
boolean |
|
void |
|
Methods inherited from class org.apache.commons.httpclient.auth.RFC2617Scheme | |
getID , getParameter , getParameters , getRealm , processChallenge |
public DigestScheme()
Default constructor for the digest authetication scheme.
- Since:
- 3.0
public DigestScheme(String challenge) throws MalformedChallengeException
Deprecated. Use parameterless constructor and
AuthScheme.processChallenge(String)
methodConstructor for the digest authetication scheme.
- Parameters:
challenge
- authentication challenge
- Throws:
MalformedChallengeException
- is thrown if the authentication challenge is malformed
public String authenticate(Credentials credentials, String method, String uri) throws AuthenticationException
Deprecated. Use
authenticate(Credentials,HttpMethod)
Produces a digest authorization string for the given set ofCredentials
, method name and URI.
- Specified by:
- authenticate in interface AuthScheme
- Parameters:
credentials
- A set of credentials to be used for athenticationmethod
- the name of the method that requires authorization.uri
- The URI for which authorization is needed.
- Returns:
- a digest authorization string
- Throws:
AuthenticationException
- if authorization string cannot be generated due to an authentication failure
- See Also:
HttpMethod.getName()
,HttpMethod.getPath()
public String authenticate(Credentials credentials, HttpMethod method) throws AuthenticationException
Produces a digest authorization string for the given set ofCredentials
, method name and URI.
- Specified by:
- authenticate in interface AuthScheme
- Parameters:
credentials
- A set of credentials to be used for athenticationmethod
- The method being authenticated
- Returns:
- a digest authorization string
- Throws:
AuthenticationException
- if authorization string cannot be generated due to an authentication failure
- Since:
- 3.0
public static String createCnonce()
Creates a random cnonce value based on the current time.
- Returns:
- The cnonce value as String.
public String getID()
Deprecated. no longer used
Gets an ID based upon the realm and the nonce value. This ensures that requests to the same realm with different nonce values will succeed. This differentiation allows servers to request re-authentication using a fresh nonce value.
- Specified by:
- getID in interface AuthScheme
- Overrides:
- getID in interface RFC2617Scheme
public String getSchemeName()
Returns textual designation of the digest authentication scheme.
- Specified by:
- getSchemeName in interface AuthScheme
- Returns:
digest
public boolean isComplete()
Tests if the Digest authentication process has been completed.
- Specified by:
- isComplete in interface AuthScheme
- Returns:
- true if Digest authorization has been processed, false otherwise.
- Since:
- 3.0
public boolean isConnectionBased()
Returns false. Digest authentication scheme is request based.
- Specified by:
- isConnectionBased in interface AuthScheme
- Returns:
- false.
- Since:
- 3.0
public void processChallenge(String challenge) throws MalformedChallengeException
Processes the Digest challenge.
- Specified by:
- processChallenge in interface AuthScheme
- Overrides:
- processChallenge in interface RFC2617Scheme
- Parameters:
challenge
- the challenge string
- Throws:
MalformedChallengeException
- is thrown if the authentication challenge is malformed
- Since:
- 3.0