Overview | Package | Class | Use | Tree | Deprecated | Index | Help
|  | BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## weblogic.common
Interface ProxyAuthenticator

    public interface ProxyAuthenticator

This interface allows an application to provide user authentication information required when tunneling WebLogic HTTP and SSL protocols through a proxy server that requires user authentication.

An object that implements this interface is invoked at runtime when and if proxy authentication is needed.

The class name of the desired implementation of `ProxyAuthenticator` is registered with the system property `AUTHENTICATOR_PROPERTY`.

For example:

     import weblogic.common.ProxyAuthenticator;
     ...
     Properties p = System.getProperties();
     p.put(ProxyAuthenticator.AUTHENTICATOR_PROPERTY, "my.package.MyAuthenticator");
     System.setProperties(p);

A class of this type is instantiated with `Class.forName(classname).newInstance().`, so the class must be public and must have a default constructor, that is, a void argument constructor.

Once instantiated, the class is initialized by its `init()` method, which takes as parameters the hostname and port of the proxy that requires authentication, the authentication type required by the proxy (for example, "Basic"), and the login prompt the proxy presented, if any.

The authenticator is then asked for the login and password needed for authorization with the proxy, via its `getLoginAndPassword()` method. This method should return an array of two strings that contains the login (user) name and password. If no authentication information can be provided, then this method returns `null`, in which case the authentication (and the network communication that depended on it) fail.

The authenticator is queried as long as authentication fails. Once authentication succeeds, the authentication information is cached internally and used in all subsequent communication with that particular proxy.

Field Summary
`static String` | `AUTHENTICATOR_PROPERTY`

Method Summary
`String[]` | `getLoginAndPassword()` Gets the user login name and password required by the proxy server.
`void` | `init(String proxyHost, int proxyPort, String authType, String loginPrompt)` Initializes the proxy authenticator class.

Field Detail

### AUTHENTICATOR_PROPERTY

    static final String AUTHENTICATOR_PROPERTY

See Also:
  Constant Field Values

Method Detail

### init

    void init(String proxyHost,
              int proxyPort,
              String authType,
              String loginPrompt)

  Initializes the proxy authenticator class.

  Parameters:
    `proxyHost` - Hostname of the proxy computer
    `proxyPort` - Port number where the proxy is listing
    `authType` - Type of authorization
    `loginPrompt` - Proxy's login prompt, if any

### getLoginAndPassword

    String[] getLoginAndPassword()

  Gets the user login name and password required by the proxy server. The array that is returned is null if the proxy login name and password cannot be obtained; otherwise, the array contains two strings, the proxy login name and the password.

  Returns:
    Array of login name and password, or null

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Documentation is available at http://e-docs.bea.com/wls/docs92 Copyright 2006 BEA Systems Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD