|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.net.Authenticator
public abstract class 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.
setDefault(java.net.Authenticator),
getPasswordAuthentication()| Nested Class Summary | |
|---|---|
static class |
Authenticator.RequestorType
an enum class of requestor type |
| Constructor Summary | |
|---|---|
Authenticator()
|
|
| Method Summary | |
|---|---|
protected PasswordAuthentication |
getPasswordAuthentication()
This method is responsible for retrieving the username and password for the sender. |
protected String |
getRequestingHost()
Return the host name of the connection that requests authentication, or null if unknown. |
protected int |
getRequestingPort()
Returns the port of the connection that requests authorization. |
protected String |
getRequestingPrompt()
Returns the realm (prompt string) of the connection that requires authorization. |
protected String |
getRequestingProtocol()
Returns the protocol of the connection that requests authorization. |
protected String |
getRequestingScheme()
Returns the scheme of the connection that requires authorization. |
protected InetAddress |
getRequestingSite()
Returns 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()
returns the type of this request, it can be proxy or server |
static 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. |
static 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. |
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. |
static void |
setDefault(Authenticator a)
This method sets a to be the default authenticator. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Authenticator()
| Method Detail |
|---|
protected PasswordAuthentication getPasswordAuthentication()
It returns null by default.
protected final int getRequestingPort()
protected final InetAddress getRequestingSite()
protected final String getRequestingPrompt()
protected final String getRequestingProtocol()
protected final String getRequestingScheme()
public static PasswordAuthentication requestPasswordAuthentication(InetAddress rAddr,
int rPort,
String rProtocol,
String rPrompt,
String rScheme)
rAddr - java.net.InetAddress the address of the connection that
requests authenticationrPort - int the port of the connection that requests authenticationrProtocol - java.lang.String the protocol of the connection that requests
authenticationrPrompt - java.lang.String the realm of the connection that requests
authenticationrScheme - java.lang.String the scheme of the connection that requests
authentication
SecurityException - if requestPasswordAuthenticationPermission is deniedpublic static void setDefault(Authenticator a)
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
public static PasswordAuthentication requestPasswordAuthentication(String rHost,
InetAddress rAddr,
int rPort,
String rProtocol,
String rPrompt,
String rScheme)
rHost - java.lang.String the host name of the connection that requests
authenticationrAddr - java.net.InetAddress the address of the connection that
requests authenticationrPort - int the port of the connection that requests authenticationrProtocol - java.lang.String the protocol of the connection that requests
authenticationrPrompt - java.lang.String the realm of the connection that requests
authenticationrScheme - java.lang.String the scheme of the connection that requests
authentication
SecurityException - if requestPasswordAuthenticationPermission is deniedprotected final String getRequestingHost()
public static PasswordAuthentication requestPasswordAuthentication(String rHost,
InetAddress rAddr,
int rPort,
String rProtocol,
String rPrompt,
String rScheme,
URL rURL,
Authenticator.RequestorType reqType)
rHost - java.lang.String the host name of the connection that requests
authenticationrAddr - java.net.InetAddress the address of the connection that
requests authenticationrPort - int the port of the connection that requests authenticationrProtocol - java.lang.String the protocol of the connection that requests
authenticationrPrompt - java.lang.String the realm of the connection that requests
authenticationrScheme - java.lang.String the scheme of the connection that requests
authenticationrURL - java.net.URL the url of the connection that requests
authenticationreqType - java.net.Authenticator.RequestorType the RequestorType of the
connection that requests authentication
SecurityException - if requestPasswordAuthenticationPermission is deniedprotected URL getRequestingURL()
protected Authenticator.RequestorType getRequestorType()
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||