org.apache.http.impl.auth
Class BasicScheme

java.lang.Object
  extended by org.apache.http.impl.auth.AuthSchemeBase
      extended by org.apache.http.impl.auth.RFC2617Scheme
          extended by org.apache.http.impl.auth.BasicScheme
All Implemented Interfaces:
AuthScheme

public class BasicScheme
extends RFC2617Scheme

Basic authentication scheme as defined in RFC 2617.

Since:
4.0
Author:
Remy Maucherat, Rodney Waldhoff, Jeff Dever, Ortwin Glueck, Sean C. Sullivan, Adrian Sutton, Mike Bowler, Oleg Kalnichevski

Constructor Summary
BasicScheme()
          Default constructor for the basic authetication scheme.
 
Method Summary
 org.apache.http.Header authenticate(Credentials credentials, org.apache.http.HttpRequest request)
          Produces basic authorization header for the given set of Credentials.
static org.apache.http.Header authenticate(Credentials credentials, java.lang.String charset, boolean proxy)
          Returns a basic Authorization header value for the given Credentials and charset.
 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.RFC2617Scheme
getParameter, getParameters, getRealm, parseChallenge
 
Methods inherited from class org.apache.http.impl.auth.AuthSchemeBase
isProxy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicScheme

public BasicScheme()
Default constructor for the basic authetication scheme.

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 MalformedChallengeException
Processes the Basic challenge.

Specified by:
processChallenge in interface AuthScheme
Overrides:
processChallenge in class AuthSchemeBase
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

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

Parameters:
credentials - The set of credentials to be used for athentication
request - The request being authenticated
Returns:
a basic authorization string
Throws:
InvalidCredentialsException - if authentication credentials are not valid or not applicable for this authentication scheme
AuthenticationException - if authorization string cannot be generated due to an authentication failure

authenticate

public static org.apache.http.Header authenticate(Credentials credentials,
                                                  java.lang.String charset,
                                                  boolean proxy)
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


Copyright © 1999-2008 Apache Software Foundation. All Rights Reserved.