public final class SimpleNetworkAuthenticator extends Object implements NetworkAuthenticator
NetworkAuthenticator implementation for connectors. Instances use a single
PasswordAuthentication instance which is not dependent on the NetworkAuthenticatorContext with one
exception. The requestPasswordAuthentication(NetworkAuthenticatorContext) method only supports the
Authenticator.RequestorType#SERVER requestor type. Requests made to
requestPasswordAuthentication(NetworkAuthenticatorContext) for other requestor types will return
null.| Constructor and Description |
|---|
SimpleNetworkAuthenticator(PasswordAuthentication passwordAuthentication)
Creates a new instance with the
PasswordAuthentication instance that will be used for all authentication
requests. |
SimpleNetworkAuthenticator(String userName,
String password)
Creates a new instance with a user name and password that will be used for all authentication requests.
|
| Modifier and Type | Method and Description |
|---|---|
PasswordAuthentication |
requestPasswordAuthentication(NetworkAuthenticatorContext connectorAuthenticatorContext)
This method is used to request a
PasswordAuthentication instance based on the specified context. |
public SimpleNetworkAuthenticator(String userName, String password)
null.userName - the user namepassword - the passwordpublic SimpleNetworkAuthenticator(PasswordAuthentication passwordAuthentication)
PasswordAuthentication instance that will be used for all authentication
requests.passwordAuthentication - the password authentication instancepublic PasswordAuthentication requestPasswordAuthentication(NetworkAuthenticatorContext connectorAuthenticatorContext)
NetworkAuthenticatorPasswordAuthentication instance based on the specified context.
Implementations should use the information in the provided context to determine the correct credentials for the
request.requestPasswordAuthentication in interface NetworkAuthenticatorconnectorAuthenticatorContext - NetworkAuthenticatorContext with authentication request detailsPasswordAuthentication with user credentials if authentication is required for the network
connection, null otherwise