org.apache.commons.httpclient.auth
Interface AuthScheme

All Known Implementing Classes:
AuthSchemeBase

public interface AuthScheme

This interface represents an abstract authentication scheme.

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

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

Since:
2.0beta1
Author:
Oleg Kalnichevski, Adrian Sutton

Method Summary
 String authenticate(Credentials credentials, String method, String uri)
          Produces an authorization string for the given set of Credentials, method name and URI using the given authentication scheme.
 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.
 

Method Detail

getSchemeName

public String getSchemeName()
Returns textual designation of the given authentication scheme.
Returns:
the name of the given authentication scheme

getParameter

public String getParameter(String name)
Returns authentication parameter with the given name, if available.
Parameters:
name - The name of the parameter to be returned
Returns:
the parameter with the given name

getRealm

public String getRealm()
Returns authentication realm. If the concept of an authentication realm is not applicable to the given authentication scheme, returns null.
Returns:
the authentication realm

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.

Returns:
String a String identifying the authentication challenge. The returned value may be null.

authenticate

public String authenticate(Credentials credentials,
                           String method,
                           String uri)
                    throws AuthenticationException
Produces an authorization string for the given set of Credentials, method name and URI using the given authentication scheme.
Parameters:
credentials - The set of credentials to be used for athentication
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
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
Returns:
the authorization string
Throws:
AuthenticationException - if authorization string cannot be generated due to an authentication failure
See Also:
HttpMethod.getName(), HttpMethod.getPath()


Copyright © 2001-2004 Apache Software Foundation. All Rights Reserved.