org.apache.commons.httpclient.auth

Class BasicScheme

public class BasicScheme extends RFC2617Scheme

Basic authentication scheme as defined in RFC 2617.

Author: Remy Maucherat Rodney Waldhoff Jeff Dever Ortwin Gl?ck Sean C. Sullivan Adrian Sutton Mike Bowler Oleg Kalnichevski

Constructor Summary
BasicScheme()
Default constructor for the basic authetication scheme.
BasicScheme(String challenge)
Constructor for the basic authetication scheme.
Method Summary
Stringauthenticate(Credentials credentials, String method, String uri)
Produces basic authorization string for the given set of Credentials.
Stringauthenticate(Credentials credentials, HttpMethod method)
Produces basic authorization string for the given set of Credentials.
static Stringauthenticate(UsernamePasswordCredentials credentials)
static Stringauthenticate(UsernamePasswordCredentials credentials, String charset)
Returns a basic Authorization header value for the given UsernamePasswordCredentials and charset.
StringgetSchemeName()
Returns textual designation of the basic authentication scheme.
booleanisComplete()
Tests if the Basic authentication process has been completed.
booleanisConnectionBased()
Returns false.
voidprocessChallenge(String challenge)
Processes the Basic challenge.

Constructor Detail

BasicScheme

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

Since: 3.0

BasicScheme

public BasicScheme(String challenge)

Deprecated: Use parameterless constructor and processChallenge method

Constructor for the basic authetication scheme.

Parameters: challenge authentication challenge

Throws: MalformedChallengeException is thrown if the authentication challenge is malformed

Method Detail

authenticate

public String authenticate(Credentials credentials, String method, String uri)

Deprecated: Use BasicScheme

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: 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 String authenticate(Credentials credentials, HttpMethod method)
Produces basic authorization string for the given set of Credentials.

Parameters: credentials The set of credentials to be used for athentication method The method 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

Since: 3.0

authenticate

public static String authenticate(UsernamePasswordCredentials credentials)

Deprecated: Use BasicScheme Returns a basic Authorization header value for the given UsernamePasswordCredentials.

Parameters: credentials The credentials to encode.

Returns: a basic authorization string

authenticate

public static String authenticate(UsernamePasswordCredentials credentials, String charset)
Returns a basic Authorization header value for the given UsernamePasswordCredentials and charset.

Parameters: credentials The credentials to encode. charset The charset to use for encoding the credentials

Returns: a basic authorization string

Since: 3.0

getSchemeName

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

Returns: basic

isComplete

public boolean isComplete()
Tests if the Basic authentication process has been completed.

Returns: true if Basic authorization has been processed, false otherwise.

Since: 3.0

isConnectionBased

public boolean isConnectionBased()
Returns false. Basic authentication scheme is request based.

Returns: false.

Since: 3.0

processChallenge

public void processChallenge(String challenge)
Processes the Basic challenge.

Parameters: challenge the challenge string

Throws: MalformedChallengeException is thrown if the authentication challenge is malformed

Since: 3.0

Copyright (c) 1999-2005 - Apache Software Foundation