org.apache.http.impl.auth
Class BasicSchemeHC4

java.lang.Object
  extended by org.apache.http.impl.auth.AuthSchemeBaseHC4
      extended by org.apache.http.impl.auth.RFC2617SchemeHC4
          extended by org.apache.http.impl.auth.BasicSchemeHC4
All Implemented Interfaces:
org.apache.http.auth.AuthScheme, ContextAwareAuthScheme

@NotThreadSafe
public class BasicSchemeHC4
extends RFC2617SchemeHC4

Basic authentication scheme as defined in RFC 2617.

Since:
4.0

Constructor Summary
BasicSchemeHC4()
           
BasicSchemeHC4(ChallengeState challengeState)
          Deprecated. (4.3) do not use.
BasicSchemeHC4(java.nio.charset.Charset credentialsCharset)
           
 
Method Summary
 org.apache.http.Header authenticate(org.apache.http.auth.Credentials credentials, org.apache.http.HttpRequest request)
          Deprecated. (4.2) Use ContextAwareAuthScheme.authenticate( Credentials, HttpRequest, org.apache.http.protocol.HttpContext)
 org.apache.http.Header authenticate(org.apache.http.auth.Credentials credentials, org.apache.http.HttpRequest request, org.apache.http.protocol.HttpContext context)
          Produces basic authorization header for the given set of Credentials.
static org.apache.http.Header authenticate(org.apache.http.auth.Credentials credentials, java.lang.String charset, boolean proxy)
          Deprecated. (4.3) use authenticate(Credentials, HttpRequest, HttpContext).
 java.lang.String getSchemeName()
          Returns textual designation of the basic authentication scheme.
 boolean isComplete()
          Tests if the Basic authentication process has been completed.
 boolean isConnectionBased()
          Returns false.
 void processChallenge(org.apache.http.Header header)
          Processes the Basic challenge.
 
Methods inherited from class org.apache.http.impl.auth.RFC2617SchemeHC4
getCredentialsCharset, getParameter, getParameters, getRealm, parseChallenge
 
Methods inherited from class org.apache.http.impl.auth.AuthSchemeBaseHC4
getChallengeState, isProxy, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BasicSchemeHC4

public BasicSchemeHC4(java.nio.charset.Charset credentialsCharset)
Since:
4.3

BasicSchemeHC4

@Deprecated
public BasicSchemeHC4(ChallengeState challengeState)
Deprecated. (4.3) do not use.

Creates an instance of BasicScheme with the given challenge state.

Since:
4.2

BasicSchemeHC4

public BasicSchemeHC4()
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 org.apache.http.auth.MalformedChallengeException
Processes the Basic challenge.

Specified by:
processChallenge in interface org.apache.http.auth.AuthScheme
Overrides:
processChallenge in class AuthSchemeBaseHC4
Parameters:
header - the challenge header
Throws:
org.apache.http.auth.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 org.apache.http.Header authenticate(org.apache.http.auth.Credentials credentials,
                                                      org.apache.http.HttpRequest request)
                                    throws org.apache.http.auth.AuthenticationException
Deprecated. (4.2) Use ContextAwareAuthScheme.authenticate( Credentials, HttpRequest, org.apache.http.protocol.HttpContext)

Throws:
org.apache.http.auth.AuthenticationException

authenticate

public org.apache.http.Header authenticate(org.apache.http.auth.Credentials credentials,
                                           org.apache.http.HttpRequest request,
                                           org.apache.http.protocol.HttpContext context)
                                    throws org.apache.http.auth.AuthenticationException
Produces basic authorization header for the given set of Credentials.

Specified by:
authenticate in interface ContextAwareAuthScheme
Overrides:
authenticate in class AuthSchemeBaseHC4
Parameters:
credentials - The set of credentials to be used for authentication
request - The request being authenticated
context - HTTP context
Returns:
a basic authorization string
Throws:
org.apache.http.auth.InvalidCredentialsException - if authentication credentials are not valid or not applicable for this authentication scheme
org.apache.http.auth.AuthenticationException - if authorization string cannot be generated due to an authentication failure

authenticate

@Deprecated
public static org.apache.http.Header authenticate(org.apache.http.auth.Credentials credentials,
                                                             java.lang.String charset,
                                                             boolean proxy)
Deprecated. (4.3) use authenticate(Credentials, HttpRequest, HttpContext).

Returns a basic Authorization header value for the given Credentials and charset.

Parameters:
credentials - The credentials to encode.
charset - The charset to use for encoding the credentials
Returns:
a basic authorization header