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:
Serializable
,AuthScheme
,ContextAwareAuthScheme
Basic authentication scheme as defined in RFC 2617.
- Since:
- 4.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionBasicScheme
(Charset credentialsCharset) BasicScheme
(ChallengeState challengeState) Deprecated.(4.3) do not use. -
Method Summary
Modifier and TypeMethodDescriptionstatic Header
authenticate
(Credentials credentials, String charset, boolean proxy) Deprecated.authenticate
(Credentials credentials, HttpRequest request) authenticate
(Credentials credentials, HttpRequest request, HttpContext context) Produces basic authorization header for the given set ofCredentials
.Returns textual designation of the basic authentication scheme.boolean
Tests if the Basic authentication process has been completed.boolean
Returnsfalse
.void
processChallenge
(Header header) Processes the Basic challenge.toString()
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 Details
-
BasicScheme
- Since:
- 4.3
-
BasicScheme
Deprecated.(4.3) do not use.Creates an instance ofBasicScheme
with the given challenge state.- Since:
- 4.2
-
BasicScheme
public BasicScheme()
-
-
Method Details
-
getSchemeName
Returns textual designation of the basic authentication scheme.- Returns:
basic
-
processChallenge
Processes the Basic challenge.- Specified by:
processChallenge
in interfaceAuthScheme
- Overrides:
processChallenge
in 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:
true
if Basic authorization has been processed,false
otherwise.
-
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:AuthScheme
Produces 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:
authenticate
in interfaceContextAwareAuthScheme
- Overrides:
authenticate
in 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, String charset, boolean proxy) Deprecated.Returns a basicAuthorization
header value for the givenCredentials
and charset.- Parameters:
credentials
- The credentials to encode.charset
- The charset to use for encoding the credentials- Returns:
- a basic authorization header
-
toString
- Overrides:
toString
in classAuthSchemeBase
-