|
Java Platform 1.2 Beta 4 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.net.Authenticator
Applications use this class by creating a subclass, and registering an instance of that subclass with the system with setDefault(). When authentication is required, the system will invoke a method on the subclass (like getPasswordAuthentication). The subclass's method can query about the authentication being requested with a number of inherited methods (getRequestingXXX()), and form an appropriate message for the user.
All methods that request authentication have a default implementation that fails.
java.net.Authenticator.setDefault(java.net.ConnectionAuthenticator)
,
java.net.getPasswordAuthentication()
Method Summary | |
protected PasswordAuthentication | getPasswordAuthentication()
Called when password authorization is needed. |
protected int | getRequestingPort()
|
protected String | getRequestingPrompt()
|
protected String | getRequestingProtocol()
Give the protocol that's requesting the connection. |
protected String | getRequestingScheme()
|
protected InetAddress | getRequestingSite()
|
static PasswordAuthentication | requestPasswordAuthentication(InetAddress addr,
int port,
String protocol,
String prompt,
String scheme)
Ask the authenticator that has been registered with the system for a password. |
static void | setDefault(Authenticator a)
Sets the authenticator that will be used by the networking code when a proxy or an HTTP server asks for authenticator. |
Methods inherited from class java.lang.Object | |
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait |
Method Detail |
public static void setDefault(Authenticator a)
null
and no
authenticator has been established, then no action is taken
and the method simply returns.
If the caller does not have the java.net.Net "setDefaultAuthenticator" permission, then a java.lang.SecurityException will be thrown.
Typically, this will be called exactly once, at system startup.
a
- The authenticatorpublic static PasswordAuthentication requestPasswordAuthentication(InetAddress addr, int port, String protocol, String prompt, String scheme)
If the caller does not have java.net.Net "requestPasswordAuthentication" permission, a java.lang.SecurityException will be thrown.
addr
- The InetAddress of the site requesting authorization,
or null if not known.
port
- the port for the requested connection
protocol
- The protocol that's requesting the connection
(@see java.net.Authenticator.getProtocol())
prompt
- A prompt string for the user
scheme
- The authentication schemeprotected final InetAddress getRequestingSite()
protected final int getRequestingPort()
protected final String getRequestingProtocol()
java.net.URL.getProtocol()
protected final String getRequestingPrompt()
protected final String getRequestingScheme()
protected PasswordAuthentication getPasswordAuthentication()
|
Java Platform 1.2 Beta 4 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |