org.apache.commons.httpclient.auth
public class BasicScheme extends RFC2617Scheme
Basic authentication scheme as defined in RFC 2617.
| Constructor and Description |
|---|
BasicScheme()
Default constructor for the basic authetication scheme.
|
BasicScheme(java.lang.String challenge)
Deprecated.
Use parameterless constructor and
AuthScheme.processChallenge(String)
method |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
authenticate(Credentials credentials,
HttpMethod method)
Produces basic authorization string for the given set of
Credentials. |
java.lang.String |
authenticate(Credentials credentials,
java.lang.String method,
java.lang.String uri)
Deprecated.
|
static java.lang.String |
authenticate(UsernamePasswordCredentials credentials)
Deprecated.
Use
authenticate(UsernamePasswordCredentials, String)
Returns a basic Authorization header value for the given
UsernamePasswordCredentials. |
static java.lang.String |
authenticate(UsernamePasswordCredentials credentials,
java.lang.String charset)
Returns a basic Authorization header value for the given
UsernamePasswordCredentials and charset. |
java.lang.String |
getSchemeName()
Returns textual designation of the basic authentication scheme.
|
boolean |
isComplete()
Tests if the Basic authentication process has been completed.
|
boolean |
isConnectionBased()
Returns false.
|
void |
processChallenge(java.lang.String challenge)
Processes the Basic challenge.
|
getID, getParameter, getParameters, getRealmpublic BasicScheme()
public BasicScheme(java.lang.String challenge)
throws MalformedChallengeException
AuthScheme.processChallenge(String)
methodchallenge - authentication challengeMalformedChallengeException - is thrown if the authentication challenge
is malformedpublic java.lang.String getSchemeName()
basicpublic void processChallenge(java.lang.String challenge)
throws MalformedChallengeException
processChallenge in interface AuthSchemeprocessChallenge in class RFC2617Schemechallenge - the challenge stringMalformedChallengeException - is thrown if the authentication challenge
is malformedpublic boolean isComplete()
public java.lang.String authenticate(Credentials credentials, java.lang.String method, java.lang.String uri) throws AuthenticationException
authenticate(Credentials, HttpMethod)Credentials.credentials - The set of credentials to be used for athenticationmethod - Method name is ignored by the basic authentication schemeuri - URI is ignored by the basic authentication schemeInvalidCredentialsException - if authentication credentials
are not valid or not applicable for this authentication schemeAuthenticationException - if authorization string cannot
be generated due to an authentication failureHttpMethod.getName(),
HttpMethod.getPath()public boolean isConnectionBased()
public java.lang.String authenticate(Credentials credentials, HttpMethod method) throws AuthenticationException
Credentials.credentials - The set of credentials to be used for athenticationmethod - The method being authenticatedInvalidCredentialsException - if authentication credentials
are not valid or not applicable for this authentication schemeAuthenticationException - if authorization string cannot
be generated due to an authentication failurepublic static java.lang.String authenticate(UsernamePasswordCredentials credentials)
authenticate(UsernamePasswordCredentials, String)
Returns a basic Authorization header value for the given
UsernamePasswordCredentials.credentials - The credentials to encode.public static java.lang.String authenticate(UsernamePasswordCredentials credentials, java.lang.String charset)
UsernamePasswordCredentials and charset.credentials - The credentials to encode.charset - The charset to use for encoding the credentials