Skip navigation links

Oracle Application Server HTTPClient Java API Reference
10g Release 3 (10.1.3.1.0)

B32117-01


HTTPClient
Class AuthenticationSchemeRegistry

java.lang.Object
  extended byHTTPClient.AuthenticationSchemeRegistry

All Implemented Interfaces:
SystemPropertyNames

public final class AuthenticationSchemeRegistry
extends java.lang.Object
implements SystemPropertyNames

The AuthenticationSchemeRegistry is a collection of AuthenticationScheme objects, each implementing a specific HTTP authentication scheme. Clients may register, unregister and get each AuthenticationScheme implementation by scheme name. An iterator of AuthenticationScheme objects may also be obtained.

AuthenticationSchemeRegistry is pre-loaded with authentication schemes inherently supported by HTTPClient. The registry may be configured using System properties to include additional authentication schemes. Or, additional authentication schemes may be added programmatically.


Field Summary
static java.lang.String[] BUILT_IN_AUTHENTICATION_SCHEMES
          Array of built-in AuthenticationScheme concrete class names.
static java.lang.String RESP_AUTH_HEADER
          Response header indicating the resource server requires authentication.
static java.lang.String RESP_AUTH_PROXY_HEADER
          Response header indicating the proxy server requires authentication.

 

Fields inherited from interface HTTPClient.SystemPropertyNames
AUTHENTICATION_SCHEME_SYSTEM_PROPERTY_NAMESPACE, HTTP_CLIENT_SYSTEM_PROPERTY_NAMESPACE, NTLM_SYSTEM_PROPERTY_NAMESPACE, SYSPROP_DEFAULT_HOSTNAME_VERIFIER, SYSPROP_DEFAULT_NTLM_DOMAIN_NAME, SYSPROP_PREFER_ORACLE_SSL

 

Constructor Summary
protected AuthenticationSchemeRegistry()
          Constructor

 

Method Summary
 AuthenticationScheme addScheme(AuthenticationScheme schemeObject)
          Adds the authentication scheme to the registry.
protected  AuthenticationScheme createScheme(java.lang.String schemeClassName)
          Attempts to create a new instance of the class with the given class name, which is expected to implement AuthenticationScheme.
 AuthenticationScheme getScheme(java.lang.String schemeName)
          Determines a registered AuthenticationScheme object corresponding to the given scheme name.
 int getSchemeCount()
          Determines the number of registered schemes.
 java.util.Iterator getSchemeNameIterator()
          Determines an iterator for the currently registered scheme names.
 boolean hasScheme(java.lang.String schemeName)
          Determines whether an AuthenticationScheme object corresponding to the given scheme name is registered.
 boolean isAnyAuthChallengeConnectionOriented(HTTPClient.CIHashtable headers, boolean forProxy)
          Determines whether any registered authentication scheme used in the given response headers, is connection oriented.
 boolean isEmpty()
          Determines whether the registry is empty.
 int loadSchemes()
          loadSchemes() populates the registry with AuthenticationScheme implementations specified in two different ways.
static AuthenticationSchemeRegistry newInstance(boolean preLoad)
          A factory method for instantiating this class.
 void removeAllSchemes()
          Unregisters (removes) all authentication schemes from this registry.
 AuthenticationScheme removeScheme(java.lang.String schemeName)
          Unregisters (removes) the authentication scheme, with the associated schemeName, from the registry.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

RESP_AUTH_HEADER

public static final java.lang.String RESP_AUTH_HEADER
Response header indicating the resource server requires authentication.
See Also:
Constant Field Values

RESP_AUTH_PROXY_HEADER

public static final java.lang.String RESP_AUTH_PROXY_HEADER
Response header indicating the proxy server requires authentication.
See Also:
Constant Field Values

BUILT_IN_AUTHENTICATION_SCHEMES

public static final java.lang.String[] BUILT_IN_AUTHENTICATION_SCHEMES

Array of built-in AuthenticationScheme concrete class names. Each class MUST implement AuthenticationScheme and MUST have a no-argument constructor.

NOTE: The dependency on built-in AuthenticationScheme implementations from the registry is "soft". If a built-in AuthenticationScheme is not found in the classpath, the scheme will simply not be loaded, and the event will be logged.

Constructor Detail

AuthenticationSchemeRegistry

protected AuthenticationSchemeRegistry()
Constructor

Method Detail

newInstance

public static AuthenticationSchemeRegistry newInstance(boolean preLoad)
A factory method for instantiating this class.
Parameters:
preLoad - true to automatically populate the registry by calling loadSchemes(), otherwise false.
Returns:
A new instance of this class

addScheme

public AuthenticationScheme addScheme(AuthenticationScheme schemeObject)
                               throws java.lang.IllegalArgumentException

Adds the authentication scheme to the registry. The scheme name is determined by calling AuthenticationScheme.getSchemeName().

If an AuthenticationScheme object is already registered under the scheme name, the registered scheme will be replaced with the given AuthenticationScheme object.

Parameters:
schemeObject - The AuthenticationScheme object
Returns:
The AuthenticationScheme object previously registered under the schemeName, null if none.
Throws:
java.lang.IllegalArgumentException - Invalid arguments given

getScheme

public AuthenticationScheme getScheme(java.lang.String schemeName)
                               throws java.lang.IllegalArgumentException

Determines a registered AuthenticationScheme object corresponding to the given scheme name.

Parameters:
schemeName - The scheme name
Returns:
The AuthenticationScheme object, null if none.
Throws:
java.lang.IllegalArgumentException - Invalid arguments given

hasScheme

public boolean hasScheme(java.lang.String schemeName)
                  throws java.lang.IllegalArgumentException

Determines whether an AuthenticationScheme object corresponding to the given scheme name is registered.

Parameters:
schemeName - The scheme name
Returns:
true if found, otherwise false.
Throws:
java.lang.IllegalArgumentException - Invalid arguments given

isEmpty

public boolean isEmpty()

Determines whether the registry is empty.

Returns:
true if empty, otherwise false.

getSchemeCount

public int getSchemeCount()

Determines the number of registered schemes.

Returns:
The count

removeScheme

public AuthenticationScheme removeScheme(java.lang.String schemeName)
                                  throws java.lang.IllegalArgumentException

Unregisters (removes) the authentication scheme, with the associated schemeName, from the registry.

Parameters:
schemeName - The scheme name
Returns:
The AuthenticationScheme object previously registered under the schemeName, null if none.
Throws:
java.lang.IllegalArgumentException - Invalid arguments given

removeAllSchemes

public void removeAllSchemes()

Unregisters (removes) all authentication schemes from this registry.


getSchemeNameIterator

public java.util.Iterator getSchemeNameIterator()

Determines an iterator for the currently registered scheme names. Use getScheme(String) to retrieve the AuthenticationScheme object corresponding to the scheme name.

NOTE: The scheme name case is insignificant.

WARNING: If the registry is modifier while an iteration is in progress, the results of the iteration are undefined.

Returns:
The iterator

createScheme

protected AuthenticationScheme createScheme(java.lang.String schemeClassName)
                                     throws java.lang.IllegalArgumentException,
                                            java.lang.ClassNotFoundException,
                                            java.lang.InstantiationException,
                                            java.lang.IllegalAccessException,
                                            java.lang.ClassCastException

Attempts to create a new instance of the class with the given class name, which is expected to implement AuthenticationScheme.

Parameters:
schemeClassName - The class name of the AuthenticationScheme object
Returns:
The AuthenticationScheme object.
Throws:
java.lang.IllegalArgumentException - schemeClassName is null or empty string
java.lang.ClassNotFoundException - schemeClassName could not be resolved based on the current classpath
java.lang.InstantiationException - schemeClassName represents an abstract class, an interface, an array class, a primitive type, or void; or if the class has no nullary constructor; or if the instantiation fails for some other reason.
java.lang.IllegalAccessException - The class which schemeClassName represents, or its nullary constructor, is not accessible.
java.lang.ClassCastException - The class which schemeClassName represents is not an instance of AuthenticationScheme.

loadSchemes

public int loadSchemes()

loadSchemes() populates the registry with AuthenticationScheme implementations specified in two different ways.

1. From System Properties (runtime configured):
System properties starting with the prefix SystemPropertyNames.AUTHENTICATION_SCHEME_SYSTEM_PROPERTY_NAMESPACE are assumed to specify runtime-declared AuthenticationScheme implementations. The property name (excluding the prefix) specifies the scheme name underwhich to register the scheme. The property value specifies the class name of the AuthenticationScheme implementation, which must have a no-argument constructor.

2. Built-in AuthenticationScheme implementations:
HTTPClient has built-in, supported schemes. Corresponding AuthenticationScheme implementations are loaded during loadSchemes().

Returns:
The number of schemes which COULD NOT be loaded, 0 if all specified schemes loaded successfully.

isAnyAuthChallengeConnectionOriented

public boolean isAnyAuthChallengeConnectionOriented(HTTPClient.CIHashtable headers,
                                                    boolean forProxy)
                                             throws java.lang.IllegalArgumentException
Determines whether any registered authentication scheme used in the given response headers, is connection oriented.
Parameters:
headers - Response headers
forProxy - true<code/> if we are connected to a proxy, otherwise false<code/>.
Returns:
true<code/> if any authentication scheme used in the given response headers is connection oriented, otherwise false<code/>.
Throws:
java.lang.IllegalArgumentException - An input is null<code/>.

Skip navigation links

Oracle Application Server HTTPClient Java API Reference
10g Release 3 (10.1.3.1.0)

B32117-01


Copyright © 2004, 2006, Oracle. All rights reserved.