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
-
-
Field Summary
Fields Modifier and Type Field Description private booleancompleteWhether the basic authentication process is completeprivate static longserialVersionUID-
Fields inherited from class org.apache.http.impl.auth.AuthSchemeBase
challengeState
-
-
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 org.apache.http.Headerauthenticate(Credentials credentials, java.lang.String charset, boolean proxy)Deprecated.org.apache.http.Headerauthenticate(Credentials credentials, org.apache.http.HttpRequest request)org.apache.http.Headerauthenticate(Credentials credentials, org.apache.http.HttpRequest request, org.apache.http.protocol.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(org.apache.http.Header header)Processes the Basic challenge.java.lang.StringtoString()-
Methods inherited from class org.apache.http.impl.auth.RFC2617Scheme
getCredentialsCharset, getCredentialsCharset, getParameter, getParameters, getRealm, parseChallenge
-
Methods inherited from class org.apache.http.impl.auth.AuthSchemeBase
getChallengeState, isProxy
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
complete
private boolean complete
Whether the basic authentication process is complete
-
-
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(org.apache.http.Header header) throws MalformedChallengeExceptionProcesses 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 org.apache.http.Header authenticate(Credentials credentials, org.apache.http.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 org.apache.http.Header authenticate(Credentials credentials, org.apache.http.HttpRequest request, org.apache.http.protocol.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 org.apache.http.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
-
-