Class DigestScheme
- java.lang.Object
-
- org.apache.commons.httpclient.auth.RFC2617Scheme
-
- org.apache.commons.httpclient.auth.DigestScheme
-
- All Implemented Interfaces:
AuthScheme
@Deprecated public class DigestScheme extends RFC2617Scheme
Deprecated.Jakarta Commons HttpClient 3.x is deprecated in the Jenkins project. It is not recommended to use it in any new code. Instead, use HTTP client API plugins as a dependency in your code. E.g. Apache HttpComponents Client API 4.x Plugin or Async HTTP Client Plugin.Digest authentication scheme as defined in RFC 2617. Both MD5 (default) and MD5-sess are supported. Currently only qop=auth or no qop is supported. qop=auth-int is unsupported. If auth and auth-int are provided, auth is used.
Credential charset is configured via the
TODO: make class more stateful regarding repeated authentication requestscredential 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 thehttp element charset
.
-
-
Constructor Summary
Constructors Constructor Description DigestScheme()
Deprecated.Default constructor for the digest authetication scheme.DigestScheme(java.lang.String challenge)
Deprecated.Use parameterless constructor andAuthScheme.processChallenge(String)
method
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.String
authenticate(Credentials credentials, java.lang.String method, java.lang.String uri)
Deprecated.java.lang.String
authenticate(Credentials credentials, HttpMethod method)
Deprecated.Produces a digest authorization string for the given set ofCredentials
, method name and URI.static java.lang.String
createCnonce()
Deprecated.Creates a random cnonce value based on the current time.java.lang.String
getID()
Deprecated.no longer usedjava.lang.String
getSchemeName()
Deprecated.Returns textual designation of the digest authentication scheme.boolean
isComplete()
Deprecated.Tests if the Digest authentication process has been completed.boolean
isConnectionBased()
Deprecated.Returns false.void
processChallenge(java.lang.String challenge)
Deprecated.Processes the Digest challenge.-
Methods inherited from class org.apache.commons.httpclient.auth.RFC2617Scheme
getParameter, getRealm
-
-
-
-
Constructor Detail
-
DigestScheme
public DigestScheme()
Deprecated.Default constructor for the digest authetication scheme.- Since:
- 3.0
-
DigestScheme
public DigestScheme(java.lang.String challenge) throws MalformedChallengeException
Deprecated.Use parameterless constructor andAuthScheme.processChallenge(String)
methodConstructor for the digest authetication scheme.- Parameters:
challenge
- authentication challenge- Throws:
MalformedChallengeException
- is thrown if the authentication challenge is malformed
-
-
Method Detail
-
getID
public java.lang.String getID()
Deprecated.no longer usedGets 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 interfaceAuthScheme
- Overrides:
getID
in classRFC2617Scheme
- Returns:
- String a String identifying the authentication challenge. The returned value may be null.
-
processChallenge
public void processChallenge(java.lang.String challenge) throws MalformedChallengeException
Deprecated.Processes the Digest challenge.- Specified by:
processChallenge
in interfaceAuthScheme
- Overrides:
processChallenge
in classRFC2617Scheme
- Parameters:
challenge
- the challenge string- Throws:
MalformedChallengeException
- is thrown if the authentication challenge is malformed- Since:
- 3.0
-
isComplete
public boolean isComplete()
Deprecated.Tests if the Digest authentication process has been completed.- Returns:
- true if Digest authorization has been processed, false otherwise.
- Since:
- 3.0
-
getSchemeName
public java.lang.String getSchemeName()
Deprecated.Returns textual designation of the digest authentication scheme.- Returns:
digest
-
isConnectionBased
public boolean isConnectionBased()
Deprecated.Returns false. Digest authentication scheme is request based.- Returns:
- false.
- Since:
- 3.0
-
authenticate
public java.lang.String authenticate(Credentials credentials, java.lang.String method, java.lang.String uri) throws AuthenticationException
Deprecated.Produces a digest authorization string for the given set ofCredentials
, method name and URI.- 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:
InvalidCredentialsException
- if authentication credentials are not valid or not applicable for this authentication schemeAuthenticationException
- if authorization string cannot be generated due to an authentication failure- See Also:
HttpMethod.getName()
,HttpMethod.getPath()
-
authenticate
public java.lang.String authenticate(Credentials credentials, HttpMethod method) throws AuthenticationException
Deprecated.Produces a digest authorization string for the given set ofCredentials
, method name and URI.- Parameters:
credentials
- A set of credentials to be used for athenticationmethod
- The method being authenticated- Returns:
- a digest authorization string
- Throws:
InvalidCredentialsException
- if authentication credentials are not valid or not applicable for this authentication schemeAuthenticationException
- if authorization string cannot be generated due to an authentication failure- Since:
- 3.0
-
createCnonce
public static java.lang.String createCnonce()
Deprecated.Creates a random cnonce value based on the current time.- Returns:
- The cnonce value as String.
- Throws:
HttpClientError
- if MD5 algorithm is not supported.
-
-