org.apache.commons.httpclient.auth
Interface AuthScheme

public interface AuthScheme

This interface represents an abstract challenge-response oriented authentication scheme.

An authentication scheme should be able to support the following functions:

  • Parse and process the challenge sent by the targer server in response to request for a protected resource
  • Provide its textual designation
  • Provide its parameters, if available
  • Provide the realm this authentication scheme is applicable to, if available
  • Generate authorization string for the given set of credentials, request method and URI as specificed in the HTTP request line in response to the actual authorization challenge

Authentication schemes may ignore method name and URI parameters if they are not relevant for the given authentication mechanism

Authentication schemes may be stateful involving a series of challenge-response exchanges

Since2.0beta1
VersionNot specified.
Author<a href="mailto:oleg@ural.ru">Oleg Kalnichevski</a>, <a href="mailto:adrian@ephox.com">Adrian Sutton</a>
Wiki javadoc Use textile entry format.
Add your comments here.
Method Summary
String authenticate( Credentials credentials, String method, String uri )
No description provided.
String authenticate( Credentials credentials, HttpMethod method )
Produces an authorization string for the given set of Credentials .
String getID()
Returns a String identifying the authentication challenge.
String getParameter( String name )
Returns authentication parameter with the given name, if available.
String getRealm()
Returns authentication realm.
String getSchemeName()
Returns textual designation of the given authentication scheme.
boolean isComplete()
Authentication process may involve a series of challenge-response exchanges.
boolean isConnectionBased()
Tests if the authentication scheme is provides authorization on a per connection basis instead of usual per request basis
void processChallenge( String challenge )
Processes the given challenge token.
authenticate
public String authenticate ( Credentials credentials, String method, String uri )
No description provided.
Parameters
TypeNameDescription
Credentials credentials The set of credentials to be used for athentication
String method The name of the method that requires authorization. This parameter may be ignored, if it is irrelevant or not applicable to the given authentication scheme
String uri The URI for which authorization is needed. This parameter may be ignored, if it is irrelevant or not applicable to the given authentication scheme
Exceptions
AuthenticationException if authorization string cannot be generated due to an authentication failure
Wiki javadoc Use textile entry format.
Add your comments here.
authenticate
public String authenticate ( Credentials credentials, HttpMethod method )
Produces an authorization string for the given set of Credentials .
Since: 3.0
Parameters
TypeNameDescription
Credentials credentials The set of credentials to be used for athentication
HttpMethod method The method being authenticated
Exceptions
AuthenticationException if authorization string cannot be generated due to an authentication failure
Wiki javadoc Use textile entry format.
Add your comments here.
getID
public String getID ( )
Returns a String identifying the authentication challenge. This is used, in combination with the host and port to determine if authorization has already been attempted or not. Schemes which require multiple requests to complete the authentication should return a different value for each stage in the request.

Additionally, the ID should take into account any changes to the authentication challenge and return a different value when appropriate. For example when the realm changes in basic authentication it should be considered a different authentication attempt and a different value should be returned.

Wiki javadoc Use textile entry format.
Add your comments here.
getParameter
public String getParameter ( String name )
Returns authentication parameter with the given name, if available.
Parameters
TypeNameDescription
String name The name of the parameter to be returned
Wiki javadoc Use textile entry format.
Add your comments here.
getRealm
public String getRealm ( )
Returns authentication realm. If the concept of an authentication realm is not applicable to the given authentication scheme, returns null.
Wiki javadoc Use textile entry format.
Add your comments here.
getSchemeName
public String getSchemeName ( )
Returns textual designation of the given authentication scheme.
Wiki javadoc Use textile entry format.
Add your comments here.
isComplete
public boolean isComplete ( )
Authentication process may involve a series of challenge-response exchanges. This method tests if the authorization process has been completed, either successfully or unsuccessfully, that is, all the required authorization challenges have been processed in their entirety.
Since: 3.0
Wiki javadoc Use textile entry format.
Add your comments here.
isConnectionBased
public boolean isConnectionBased ( )
Tests if the authentication scheme is provides authorization on a per connection basis instead of usual per request basis
Since: 3.0
Wiki javadoc Use textile entry format.
Add your comments here.
processChallenge
public void processChallenge ( String challenge )
Processes the given challenge token. Some authentication schemes may involve multiple challenge-response exchanges. Such schemes must be able to maintain the state information when dealing with sequential challenges
Since: 3.0
Parameters
TypeNameDescription
String challenge the challenge string
Returns void No description provided.
Exceptions
MalformedChallengeException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.