org.apache.commons.httpclient.auth

Class AuthPolicy

public abstract class AuthPolicy extends Object

Authentication policy class. The Authentication policy provides corresponding authentication scheme interfrace for a given type of authorization challenge.

The following specifications are provided:

Since: 3.0

Version: $Revision: 155418 $

Author: Oleg Kalnichevski

Field Summary
static StringAUTH_SCHEME_PRIORITY
The key used to look up the list of IDs of supported {@link AuthScheme authentication schemes} in their order of preference.
static StringBASIC
Basic authentication scheme as defined in RFC2617 (considered inherently insecure, but most widely supported)
static StringDIGEST
Digest authentication scheme as defined in RFC2617.
protected static LogLOG
Log object.
static StringNTLM
The NTLM scheme is a proprietary Microsoft Windows Authentication protocol (considered to be the most secure among currently supported authentication schemes).
Method Summary
static AuthSchemegetAuthScheme(String id)
Gets the {@link AuthScheme authentication scheme} with the given ID.
static ListgetDefaultAuthPrefs()
Returns a list containing all registered {@link AuthScheme authentication schemes} in their default order.
static voidregisterAuthScheme(String id, Class clazz)
Registers a class implementing an {@link AuthScheme authentication scheme} with the given identifier.
static voidunregisterAuthScheme(String id)
Unregisters the class implementing an {@link AuthScheme authentication scheme} with the given ID.

Field Detail

AUTH_SCHEME_PRIORITY

public static final String AUTH_SCHEME_PRIORITY
The key used to look up the list of IDs of supported {@link AuthScheme authentication schemes} in their order of preference. The scheme IDs are stored in a {@link java.util.Collection} as {@link java.lang.String}s.

If several schemes are returned in the WWW-Authenticate or Proxy-Authenticate header, this parameter defines which {@link AuthScheme authentication schemes} takes precedence over others. The first item in the collection represents the most preferred {@link AuthScheme authentication scheme}, the last item represents the ID of the least preferred one.

See Also: DefaultHttpParams

BASIC

public static final String BASIC
Basic authentication scheme as defined in RFC2617 (considered inherently insecure, but most widely supported)

DIGEST

public static final String DIGEST
Digest authentication scheme as defined in RFC2617.

LOG

protected static final Log LOG
Log object.

NTLM

public static final String NTLM
The NTLM scheme is a proprietary Microsoft Windows Authentication protocol (considered to be the most secure among currently supported authentication schemes).

Method Detail

getAuthScheme

public static AuthScheme getAuthScheme(String id)
Gets the {@link AuthScheme authentication scheme} with the given ID.

Parameters: id the {@link AuthScheme authentication scheme} ID

Returns: {@link AuthScheme authentication scheme}

Throws: IllegalStateException if a scheme with the ID cannot be found

getDefaultAuthPrefs

public static List getDefaultAuthPrefs()
Returns a list containing all registered {@link AuthScheme authentication schemes} in their default order.

Returns: {@link AuthScheme authentication scheme}

registerAuthScheme

public static void registerAuthScheme(String id, Class clazz)
Registers a class implementing an {@link AuthScheme authentication scheme} with the given identifier. If a class with the given ID already exists it will be overridden. This ID is the same one used to retrieve the {@link AuthScheme authentication scheme} from {@link #getAuthScheme(String)}.

Please note that custom authentication preferences, if used, need to be updated accordingly for the new {@link AuthScheme authentication scheme} to take effect.

Parameters: id the identifier for this scheme clazz the class to register

See Also: getAuthScheme AUTH_SCHEME_PRIORITY

unregisterAuthScheme

public static void unregisterAuthScheme(String id)
Unregisters the class implementing an {@link AuthScheme authentication scheme} with the given ID.

Parameters: id the ID of the class to unregister

Copyright (c) 1999-2005 - Apache Software Foundation