Class BasicScheme
- java.lang.Object
-
- org.apache.commons.httpclient.auth.RFC2617Scheme
-
- org.apache.commons.httpclient.auth.BasicScheme
-
- All Implemented Interfaces:
AuthScheme
public class BasicScheme extends RFC2617Scheme
Basic authentication scheme as defined in RFC 2617.
-
-
Constructor Summary
Constructors Constructor Description BasicScheme()Default constructor for the basic authetication scheme.BasicScheme(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.Stringauthenticate(Credentials credentials, java.lang.String method, java.lang.String uri)Deprecated.java.lang.Stringauthenticate(Credentials credentials, HttpMethod method)Produces basic authorization string for the given set ofCredentials.static java.lang.Stringauthenticate(UsernamePasswordCredentials credentials)Deprecated.Useauthenticate(UsernamePasswordCredentials, String)Returns a basic Authorization header value for the givenUsernamePasswordCredentials.static java.lang.Stringauthenticate(UsernamePasswordCredentials credentials, java.lang.String charset)Returns a basic Authorization header value for the givenUsernamePasswordCredentialsand charset.java.lang.StringgetSchemeName()Returns textual designation of the basic authentication scheme.booleanisComplete()Tests if the Basic authentication process has been completed.booleanisConnectionBased()Returns false.voidprocessChallenge(java.lang.String challenge)Processes the Basic challenge.-
Methods inherited from class org.apache.commons.httpclient.auth.RFC2617Scheme
getID, getParameter, getRealm
-
-
-
-
Constructor Detail
-
BasicScheme
public BasicScheme()
Default constructor for the basic authetication scheme.- Since:
- 3.0
-
BasicScheme
public BasicScheme(java.lang.String challenge) throws MalformedChallengeExceptionDeprecated.Use parameterless constructor andAuthScheme.processChallenge(String)methodConstructor for the basic authetication scheme.- Parameters:
challenge- authentication challenge- Throws:
MalformedChallengeException- is thrown if the authentication challenge is malformed
-
-
Method Detail
-
getSchemeName
public java.lang.String getSchemeName()
Returns textual designation of the basic authentication scheme.- Returns:
basic
-
processChallenge
public void processChallenge(java.lang.String challenge) throws MalformedChallengeExceptionProcesses the Basic challenge.- Specified by:
processChallengein interfaceAuthScheme- Overrides:
processChallengein classRFC2617Scheme- Parameters:
challenge- the challenge string- Throws:
MalformedChallengeException- is thrown if the authentication challenge is malformed- Since:
- 3.0
-
isComplete
public boolean isComplete()
Tests if the Basic authentication process has been completed.- Returns:
- true if Basic authorization has been processed, false otherwise.
- Since:
- 3.0
-
authenticate
public java.lang.String authenticate(Credentials credentials, java.lang.String method, java.lang.String uri) throws AuthenticationException
Deprecated.Produces basic authorization string for the given set ofCredentials.- Parameters:
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 scheme- Returns:
- a basic 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()
-
isConnectionBased
public boolean isConnectionBased()
Returns false. Basic authentication scheme is request based.- Returns:
- false.
- Since:
- 3.0
-
authenticate
public java.lang.String authenticate(Credentials credentials, HttpMethod method) throws AuthenticationException
Produces basic authorization string for the given set ofCredentials.- Parameters:
credentials- The set of credentials to be used for athenticationmethod- The method being authenticated- Returns:
- a basic 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
-
authenticate
public static java.lang.String authenticate(UsernamePasswordCredentials credentials)
Deprecated.Useauthenticate(UsernamePasswordCredentials, String)Returns a basic Authorization header value for the givenUsernamePasswordCredentials.- Parameters:
credentials- The credentials to encode.- Returns:
- a basic authorization string
-
authenticate
public static java.lang.String authenticate(UsernamePasswordCredentials credentials, java.lang.String charset)
Returns a basic Authorization header value for the givenUsernamePasswordCredentialsand charset.- Parameters:
credentials- The credentials to encode.charset- The charset to use for encoding the credentials- Returns:
- a basic authorization string
- Since:
- 3.0
-
-