| java.lang.Object java.net.Authenticator
Authenticator | abstract public class Authenticator (Code) | | 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.
See Also: Authenticator.setDefault(Authenticator) See Also: Authenticator.getPasswordAuthentication |
Inner Class :public enum RequestorType | |
Method Summary | |
protected PasswordAuthentication | getPasswordAuthentication() This method is responsible for retrieving the username and password for
the sender. | final protected String | getRequestingHost() Return the host name of the connection that requests authentication, or
null if unknown. | final protected int | getRequestingPort() Answers the port of the connection that requests authorization. | final protected String | getRequestingPrompt() Answers the realm (prompt string) of the connection that requires
authorization. | final protected String | getRequestingProtocol() Answers the protocol of the connection that requests authorization. | final protected String | getRequestingScheme() Answers the scheme of the connection that requires authorization. | final protected InetAddress | getRequestingSite() Answers the address of the connection that requests authorization or null
if unknown. | protected URL | getRequestingURL() returns the URL of the authentication resulted in this request. | protected Authenticator.RequestorType | getRequestorType() | public static synchronized PasswordAuthentication | requestPasswordAuthentication(InetAddress rAddr, int rPort, String rProtocol, String rPrompt, String rScheme) 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. | public static synchronized PasswordAuthentication | requestPasswordAuthentication(String rHost, InetAddress rAddr, int rPort, String rProtocol, String rPrompt, String rScheme) 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. | public static PasswordAuthentication | requestPasswordAuthentication(String rHost, InetAddress rAddr, int rPort, String rProtocol, String rPrompt, String rScheme, URL rURL, Authenticator.RequestorType reqType) 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. | public static void | setDefault(Authenticator a) This method sets a to be the default authenticator. |
getPasswordAuthentication | protected PasswordAuthentication getPasswordAuthentication()(Code) | | This method is responsible for retrieving the username and password for
the sender. The implementation varies. The subclass has to overwrite
this.
It answers null by default.
java.net.PasswordAuthentication The password authentication thatit obtains |
getRequestingHost | final protected String getRequestingHost()(Code) | | Return the host name of the connection that requests authentication, or
null if unknown.
|
getRequestingPort | final protected int getRequestingPort()(Code) | | Answers the port of the connection that requests authorization.
int the port of the connection |
getRequestingPrompt | final protected String getRequestingPrompt()(Code) | | Answers the realm (prompt string) of the connection that requires
authorization.
java.lang.String the prompt string of the connection |
getRequestingProtocol | final protected String getRequestingProtocol()(Code) | | Answers the protocol of the connection that requests authorization.
java.lang.String the protocol of connection |
getRequestingScheme | final protected String getRequestingScheme()(Code) | | Answers the scheme of the connection that requires authorization. Eg.
Basic
java.lang.String the scheme of the connection |
getRequestingSite | final protected InetAddress getRequestingSite()(Code) | | Answers the address of the connection that requests authorization or null
if unknown.
InetAddress the address of the connection |
getRequestingURL | protected URL getRequestingURL()(Code) | | returns the URL of the authentication resulted in this request.
the url of request |
requestPasswordAuthentication | public static synchronized PasswordAuthentication requestPasswordAuthentication(InetAddress rAddr, int rPort, String rProtocol, String rPrompt, String rScheme)(Code) | | 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.
java.net.PasswordAuthentication the authentication info Parameters: rAddr - java.net.InetAddress the address of the connection thatrequests authentication Parameters: rPort - int the port of the connection that requests authentication Parameters: rProtocol - java.lang.String the protocol of the connection that requestsauthentication Parameters: rPrompt - java.lang.String the realm of the connection that requestsauthentication Parameters: rScheme - java.lang.String the scheme of the connection that requestsauthentication throws: SecurityException - if requestPasswordAuthenticationPermission is denied |
requestPasswordAuthentication | public static synchronized PasswordAuthentication requestPasswordAuthentication(String rHost, InetAddress rAddr, int rPort, String rProtocol, String rPrompt, String rScheme)(Code) | | 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.
java.net.PasswordAuthentication the authentication info Parameters: rHost - java.lang.String the host name of the connection that requestsauthentication Parameters: rAddr - java.net.InetAddress the address of the connection thatrequests authentication Parameters: rPort - int the port of the connection that requests authentication Parameters: rProtocol - java.lang.String the protocol of the connection that requestsauthentication Parameters: rPrompt - java.lang.String the realm of the connection that requestsauthentication Parameters: rScheme - java.lang.String the scheme of the connection that requestsauthentication throws: SecurityException - if requestPasswordAuthenticationPermission is denied |
requestPasswordAuthentication | public static PasswordAuthentication requestPasswordAuthentication(String rHost, InetAddress rAddr, int rPort, String rProtocol, String rPrompt, String rScheme, URL rURL, Authenticator.RequestorType reqType)(Code) | | 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.
java.net.PasswordAuthentication the authentication info Parameters: rHost - java.lang.String the host name of the connection that requestsauthentication Parameters: rAddr - java.net.InetAddress the address of the connection thatrequests authentication Parameters: rPort - int the port of the connection that requests authentication Parameters: rProtocol - java.lang.String the protocol of the connection that requestsauthentication Parameters: rPrompt - java.lang.String the realm of the connection that requestsauthentication Parameters: rScheme - java.lang.String the scheme of the connection that requestsauthentication Parameters: rURL - java.net.URL the url of the connection that requestsauthentication Parameters: reqType - java.net.Authenticator.RequestorType the RequestorType of theconnection that requests authentication throws: SecurityException - if requestPasswordAuthenticationPermission is denied |
setDefault | public static void setDefault(Authenticator a)(Code) | | 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".
Parameters: a - java.net.Authenticator The authenticator to be set. throws: SecurityException - if requestPasswordAuthenticationPermission is denied |
|
|