Methods Summary |
---|
protected java.net.PasswordAuthentication | getPasswordAuthentication()Returns the collected username and password for authorization. The
subclass has to override this method to return a value different to the
default which is {@code null}.
Returns {@code null} by default.
return null;
|
protected final java.lang.String | getRequestingHost()Returns the host name of the connection that requests authentication or
{@code null} if unknown.
return host;
|
protected final int | getRequestingPort()Returns the port of the connection that requests authorization.
return this.port;
|
protected final java.lang.String | getRequestingPrompt()Returns the realm (prompt string) of the connection that requests
authorization.
return this.prompt;
|
protected final java.lang.String | getRequestingProtocol()Returns the protocol of the connection that requests authorization.
return this.protocol;
|
protected final java.lang.String | getRequestingScheme()Returns the scheme of the connection that requests authorization, for
example HTTP Basic Authentication.
return this.scheme;
|
protected final java.net.InetAddress | getRequestingSite()Returns the address of the connection that requests authorization or
{@code null} if unknown.
return this.addr;
|
protected java.net.URL | getRequestingURL()Returns the URL of the authentication request.
return url;
|
protected java.net.Authenticator$RequestorType | getRequestorType()Returns the type of this request, it can be {@code PROXY} or {@code SERVER}.
return rt;
|
public static java.net.PasswordAuthentication | requestPasswordAuthentication(java.lang.String rHost, java.net.InetAddress rAddr, int rPort, java.lang.String rProtocol, java.lang.String rPrompt, java.lang.String rScheme, java.net.URL rURL, java.net.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.
SecurityManager sm = System.getSecurityManager();
if (null != sm) {
sm.checkPermission(requestPasswordAuthenticationPermission);
}
if (null == thisAuthenticator) {
return null;
}
// sets the requester info so it knows what it is requesting
// authentication for
thisAuthenticator.host = rHost;
thisAuthenticator.addr = rAddr;
thisAuthenticator.port = rPort;
thisAuthenticator.protocol = rProtocol;
thisAuthenticator.prompt = rPrompt;
thisAuthenticator.scheme = rScheme;
thisAuthenticator.url = rURL;
thisAuthenticator.rt = reqType;
// returns the authentication info obtained by the registered
// Authenticator
return thisAuthenticator.getPasswordAuthentication();
|
public static synchronized java.net.PasswordAuthentication | requestPasswordAuthentication(java.net.InetAddress rAddr, int rPort, java.lang.String rProtocol, java.lang.String rPrompt, java.lang.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.
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(requestPasswordAuthenticationPermission);
}
if (thisAuthenticator == null) {
return null;
}
// set the requester info so it knows what it is requesting
// authentication for
thisAuthenticator.addr = rAddr;
thisAuthenticator.port = rPort;
thisAuthenticator.protocol = rProtocol;
thisAuthenticator.prompt = rPrompt;
thisAuthenticator.scheme = rScheme;
thisAuthenticator.rt = RequestorType.SERVER;
// returns the authentication info obtained by the registered
// Authenticator
return thisAuthenticator.getPasswordAuthentication();
|
public static synchronized java.net.PasswordAuthentication | requestPasswordAuthentication(java.lang.String rHost, java.net.InetAddress rAddr, int rPort, java.lang.String rProtocol, java.lang.String rPrompt, java.lang.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.
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(requestPasswordAuthenticationPermission);
}
if (thisAuthenticator == null) {
return null;
}
// set the requester info so it knows what it is requesting
// authentication for
thisAuthenticator.host = rHost;
thisAuthenticator.addr = rAddr;
thisAuthenticator.port = rPort;
thisAuthenticator.protocol = rProtocol;
thisAuthenticator.prompt = rPrompt;
thisAuthenticator.scheme = rScheme;
thisAuthenticator.rt = RequestorType.SERVER;
// returns the authentication info obtained by the registered
// Authenticator
return thisAuthenticator.getPasswordAuthentication();
|
public static void | setDefault(java.net.Authenticator a)Sets {@code a} as 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 appropriate {@code
NetPermission}.
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(setDefaultAuthenticatorPermission);
}
thisAuthenticator = a;
|