| public abstract class java.net Authenticator
|
Java SE 6 |
Applications use this class by overriding #getPasswordAuthentication() in a sub-class. This method will
typically use the various getXXX() accessor methods to get information
about the entity requesting authentication. It must then acquire a
username and password either by interacting with the user or through
some other non-interactive means. The credentials are then returned
as a PasswordAuthentication return value.
An instance of this concrete sub-class is then registered
with the system by calling #setDefault(Authenticator).
When authentication is required, the system will invoke one of the
requestPasswordAuthentication() methods which in turn will call the
getPasswordAuthentication() method of the registered object.
All methods that request authentication have a default implementation that fails.
| version | 1.33, 11/17/05 |
| since | 1.2 |
| See also | setDefault(java.net.Authenticator), getPasswordAuthentication() |
| Constructors | |
|---|---|
| public | Authenticator() |
| Methods | |||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| public static PasswordAuthentication | requestPasswordAuthentication(InetAddress addr, int port, String protocol, String prompt, String scheme) Details
Ask the authenticator that has been registered with the system
for a password.
First, if there is a security manager, its
| ||||||||||||||||||||||||
| public static PasswordAuthentication | requestPasswordAuthentication(String host, InetAddress addr, int port, String protocol, String prompt, String scheme) Details
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
| ||||||||||||||||||||||||
| public static PasswordAuthentication | requestPasswordAuthentication(String host, InetAddress addr, int port, String protocol, String prompt, String scheme, URL url, Authenticator.RequestorType reqType) Details
Ask the authenticator that has been registered with the system
for a password.
First, if there is a security manager, its
| ||||||||||||||||||||||||
| Properties | |||||||
|---|---|---|---|---|---|---|---|
| public static void | setDefault(Authenticator a) Details
Sets the authenticator that will be used by the networking code
when a proxy or an HTTP server asks for authentication.
First, if there is a security manager, its
| ||||||
| protected PasswordAuthentication | getPasswordAuthentication() Details
Called when password authorization is needed. Subclasses should
override the default implementation, which returns null.
| ||||||
| final protected String | getRequestingHost() Details
Gets the hostname of the
site or proxy requesting authentication, or null
if not available.
| ||||||
| final protected int | getRequestingPort() Details
Gets the port number for the requested connection.
| ||||||
| final protected String | getRequestingPrompt() Details
Gets the prompt string given by the requestor.
| ||||||
| final protected String | getRequestingProtocol() Details
Give the protocol that's requesting the connection. Often this
will be based on a URL, but in a future JDK it could be, for
example, "SOCKS" for a password-protected SOCKS5 firewall.
| ||||||
| final protected String | getRequestingScheme() Details
Gets the scheme of the requestor (the HTTP scheme
for an HTTP firewall, for example).
| ||||||
| final protected InetAddress | getRequestingSite() Details
Gets the InetAddress of the
site requesting authorization, or null
if not available.
| ||||||
| protected URL | getRequestingURL() Details
Returns the URL that resulted in this
request for authentication.
| ||||||
| protected Authenticator.RequestorType | getRequestorType() Details
Returns whether the requestor is a Proxy or a Server.
| ||||||
| About DocWeb · Bundles · Export · Export All | Top 10 · Statistics · Login |
| About Sun · Contact · Privacy · Terms of Use · Trademarks | Java SE 6 · Copyright © 1994-2009 Sun Microsystems, Inc.All rights reserved. Use is subject to license terms |
![]() |
![]() |
|