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:
AuthScheme, ContextAwareAuthScheme
Basic authentication scheme as defined in RFC 2617.
- Since:
- 4.0
-
Constructor Summary
ConstructorsConstructorDescriptionBasicScheme(Charset credentialsCharset) BasicScheme(ChallengeState challengeState) Deprecated.(4.3) do not use. -
Method Summary
Modifier and TypeMethodDescriptionstatic Headerauthenticate(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.booleanTests if the Basic authentication process has been completed.booleanReturns false.voidprocessChallenge(Header header) Processes the Basic challenge.Methods inherited from class RFC2617Scheme
getCredentialsCharset, getParameter, getParameters, getRealm, parseChallengeMethods inherited from class AuthSchemeBase
getChallengeState, isProxy, toString
-
Constructor Details
-
BasicScheme
- Since:
- 4.3
-
BasicScheme
Deprecated.(4.3) do not use.Creates an instance of BasicScheme 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:
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:
- true if Basic authorization has been processed, false otherwise.
-
isConnectionBased
public boolean isConnectionBased()Returns false. 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, String charset, boolean proxy) Deprecated.Returns a basic Authorization header 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
-