org.apache.commons.httpclient.auth
Class BasicScheme

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


public class BasicScheme
extends RFC2617Scheme

Basic authentication scheme as defined in RFC 2617.


Constructor Summary
BasicScheme(String challenge)
          Constructor for the basic authetication scheme.
 
Method Summary
 String authenticate(Credentials credentials, String method, String uri)
          Produces basic authorization string for the given set of Credentials.
static String authenticate(UsernamePasswordCredentials credentials)
          Return a basic Authorization header value for the given UsernamePasswordCredentials.
 String getSchemeName()
          Returns textual designation of the basic authentication scheme.
 
Methods inherited from class org.apache.commons.httpclient.auth.RFC2617Scheme
getID, getParameter, getParameters, getRealm
 
Methods inherited from class org.apache.commons.httpclient.auth.AuthSchemeBase
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BasicScheme

public BasicScheme(String challenge)
            throws MalformedChallengeException
Constructor for the basic authetication scheme.

Parameters:
challenge - authentication challenge
Throws:
MalformedChallengeException - is thrown if the authentication challenge is malformed
Method Detail

getSchemeName

public String getSchemeName()
Returns textual designation of the basic authentication scheme.

Returns:
basic

authenticate

public String authenticate(Credentials credentials,
                           String method,
                           String uri)
                    throws AuthenticationException
Produces basic authorization string for the given set of Credentials.

Parameters:
credentials - The set of credentials to be used for athentication
method - Method name is ignored by the basic authentication scheme
uri - URI is ignored by the basic authentication scheme
Returns:
a basic authorization string
Throws:
AuthenticationException - if authorization string cannot be generated due to an authentication failure
See Also:
HttpMethod.getName(), HttpMethod.getPath()

authenticate

public static String authenticate(UsernamePasswordCredentials credentials)
Return a basic Authorization header value for the given UsernamePasswordCredentials.

Parameters:
credentials - The credentials to encode.
Returns:
a basic authorization string