Ask the authenticator that has been registered with the system for a password. This is the preferred method for requesting a password because the hostname can be provided in cases where the InetAddress is not available.
First, if there is a security manager, its checkPermission
method is called with a
NetPermission("requestPasswordAuthentication") permission.
This may result in a java.lang.SecurityException.
host | The hostname of the site requesting authentication. | |
addr | The InetAddress of the site requesting authentication, or null if not known. | |
port | the port for the requested connection. | |
protocol | The protocol that's requesting the connection
(java.net.Authenticator.getRequestingProtocol()) | |
prompt | A prompt string for the user which identifies the authentication realm. | |
scheme | The authentication scheme |
SecurityException
| if a security manager exists and its
checkPermission method doesn't allow
the password authentication request. |
SecurityManager.checkPermission, java.net.NetPermission
Diagram: Authenticate