| java.lang.Object | |
| ↳ | java.net.Authenticator |
This class is able to obtain authentication info for a connection, usually
from user. First the application has to set the default authenticator which
extends Authenticator by
setDefault(Authenticator a).
It should override getPasswordAuthentication() which dictates
how the authentication info should be obtained.
| Nested Classes | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Authenticator.RequestorType | an enum class of requestor type | ||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
If the permission check of the security manager does not result in a
security exception, this method invokes the methods of the registered
authenticator to get the authentication info.
| |||||||||||
If the permission check of the security manager does not result in a
security exception, this method invokes the methods of the registered
authenticator to get the authentication info.
| |||||||||||
If the permission check of the security manager does not result in a
security exception, this method invokes the methods of the registered
authenticator to get the authentication info.
| |||||||||||
This method sets
a to be the default authenticator. | |||||||||||
| Protected Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
This method is responsible for retrieving the username and password for
the sender.
| |||||||||||
Return the host name of the connection that requests authentication, or
null if unknown.
| |||||||||||
Returns the port of the connection that requests authorization.
| |||||||||||
Returns the realm (prompt string) of the connection that requires
authorization.
| |||||||||||
Returns the protocol of the connection that requests authorization.
| |||||||||||
Returns the scheme of the connection that requires authorization.
| |||||||||||
Returns the address of the connection that requests authorization or null
if unknown.
| |||||||||||
returns the URL of the authentication resulted in this request.
| |||||||||||
returns the type of this request, it can be proxy or server
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
| |||||||||||
If the permission check of the security manager does not result in a security exception, this method invokes the methods of the registered authenticator to get the authentication info.
| rHost | java.lang.String the host name of the connection that requests authentication |
|---|---|
| rAddr | java.net.InetAddress the address of the connection that requests authentication |
| rPort | int the port of the connection that requests authentication |
| rProtocol | java.lang.String the protocol of the connection that requests authentication |
| rPrompt | java.lang.String the realm of the connection that requests authentication |
| rScheme | java.lang.String the scheme of the connection that requests authentication |
| SecurityException | if requestPasswordAuthenticationPermission is denied |
|---|
If the permission check of the security manager does not result in a security exception, this method invokes the methods of the registered authenticator to get the authentication info.
| rHost | java.lang.String the host name of the connection that requests authentication |
|---|---|
| rAddr | java.net.InetAddress the address of the connection that requests authentication |
| rPort | int the port of the connection that requests authentication |
| rProtocol | java.lang.String the protocol of the connection that requests authentication |
| rPrompt | java.lang.String the realm of the connection that requests authentication |
| rScheme | java.lang.String the scheme of the connection that requests authentication |
| rURL | java.net.URL the url of the connection that requests authentication |
| reqType | java.net.Authenticator.RequestorType the RequestorType of the connection that requests authentication |
| SecurityException | if requestPasswordAuthenticationPermission is denied |
|---|
If the permission check of the security manager does not result in a security exception, this method invokes the methods of the registered authenticator to get the authentication info.
| rAddr | java.net.InetAddress the address of the connection that requests authentication |
|---|---|
| rPort | int the port of the connection that requests authentication |
| rProtocol | java.lang.String the protocol of the connection that requests authentication |
| rPrompt | java.lang.String the realm of the connection that requests authentication |
| rScheme | java.lang.String the scheme of the connection that requests authentication |
| SecurityException | if requestPasswordAuthenticationPermission is denied |
|---|
This method sets a to be the default authenticator. It
will be called whenever the realm that the URL is pointing to requires
authorization. If there is a security manager set then the caller must
have the NetPermission "setDefaultAuthenticator".
| a | java.net.Authenticator The authenticator to be set. |
|---|
| SecurityException | if requestPasswordAuthenticationPermission is denied |
|---|
This method is responsible for retrieving the username and password for the sender. The implementation varies. The subclass has to overwrite this.
It returns null by default.
Return the host name of the connection that requests authentication, or null if unknown.
Returns the port of the connection that requests authorization.
Returns the realm (prompt string) of the connection that requires authorization.
Returns the protocol of the connection that requests authorization.
Returns the scheme of the connection that requires authorization. Eg. Basic
Returns the address of the connection that requests authorization or null if unknown.
returns the URL of the authentication resulted in this request.
returns the type of this request, it can be proxy or server