Package org.apache.http.impl.auth
Class BasicScheme
- java.lang.Object
 - 
- org.apache.http.impl.auth.AuthSchemeBase
 - 
- org.apache.http.impl.auth.RFC2617Scheme
 - 
- org.apache.http.impl.auth.BasicScheme
 
 
 
 
- 
- All Implemented Interfaces:
 java.io.Serializable,AuthScheme,ContextAwareAuthScheme
public class BasicScheme extends RFC2617Scheme
Basic authentication scheme as defined in RFC 2617.- Since:
 - 4.0
 - See Also:
 - Serialized Form
 
 
- 
- 
Constructor Summary
Constructors Constructor Description BasicScheme()BasicScheme(java.nio.charset.Charset credentialsCharset)BasicScheme(ChallengeState challengeState)Deprecated.(4.3) do not use. 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static Headerauthenticate(Credentials credentials, java.lang.String charset, boolean proxy)Deprecated.Headerauthenticate(Credentials credentials, HttpRequest request)Headerauthenticate(Credentials credentials, HttpRequest request, HttpContext context)Produces basic authorization header for the given set ofCredentials.java.lang.StringgetSchemeName()Returns textual designation of the basic authentication scheme.booleanisComplete()Tests if the Basic authentication process has been completed.booleanisConnectionBased()Returnsfalse.voidprocessChallenge(Header header)Processes the Basic challenge.java.lang.StringtoString()- 
Methods inherited from class org.apache.http.impl.auth.RFC2617Scheme
getCredentialsCharset, getParameter, getRealm 
- 
Methods inherited from class org.apache.http.impl.auth.AuthSchemeBase
getChallengeState, isProxy 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
BasicScheme
public BasicScheme(java.nio.charset.Charset credentialsCharset)
- Since:
 - 4.3
 
 
- 
BasicScheme
@Deprecated public BasicScheme(ChallengeState challengeState)
Deprecated.(4.3) do not use.Creates an instance ofBasicSchemewith the given challenge state.- Since:
 - 4.2
 
 
- 
BasicScheme
public BasicScheme()
 
 - 
 
- 
Method Detail
- 
getSchemeName
public java.lang.String getSchemeName()
Returns textual designation of the basic authentication scheme.- Returns:
 basic
 
- 
processChallenge
public void processChallenge(Header header) throws MalformedChallengeException
Processes the Basic challenge.- Specified by:
 processChallengein interfaceAuthScheme- Overrides:
 processChallengein classAuthSchemeBase- Parameters:
 header- the challenge header- Throws:
 MalformedChallengeException- is thrown if the authentication challenge is malformed
 
- 
isComplete
public boolean isComplete()
Tests if the Basic authentication process has been completed.- Returns:
 trueif Basic authorization has been processed,falseotherwise.
 
- 
isConnectionBased
public boolean isConnectionBased()
Returnsfalse. Basic authentication scheme is request based.- Returns:
 false.
 
- 
authenticate
@Deprecated public Header authenticate(Credentials credentials, HttpRequest request) throws AuthenticationException
Deprecated.Description copied from interface:AuthSchemeProduces an authorization string for the given set ofCredentials.- Parameters:
 credentials- The set of credentials to be used for athenticationrequest- The request being authenticated- Returns:
 - the authorization string
 - Throws:
 AuthenticationException- if authorization string cannot be generated due to an authentication failure
 
- 
authenticate
public Header authenticate(Credentials credentials, HttpRequest request, HttpContext context) throws AuthenticationException
Produces basic authorization header for the given set ofCredentials.- Specified by:
 authenticatein interfaceContextAwareAuthScheme- Overrides:
 authenticatein classAuthSchemeBase- Parameters:
 credentials- The set of credentials to be used for authenticationrequest- The request being authenticatedcontext- HTTP context- 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
 
- 
authenticate
@Deprecated public static Header authenticate(Credentials credentials, java.lang.String charset, boolean proxy)
Deprecated.Returns a basicAuthorizationheader value for the givenCredentialsand charset.- Parameters:
 credentials- The credentials to encode.charset- The charset to use for encoding the credentials- Returns:
 - a basic authorization header
 
 
- 
toString
public java.lang.String toString()
- Overrides:
 toStringin classAuthSchemeBase
 
 - 
 
 -