53 |
* @since 1.2 |
* @since 1.2 |
54 |
* |
* |
55 |
* @author Aaron M. Renn (arenn@urbanophile.com) |
* @author Aaron M. Renn (arenn@urbanophile.com) |
56 |
|
* @status Believed to be JDK 1.4 complete |
57 |
*/ |
*/ |
58 |
public abstract class Authenticator |
public abstract class Authenticator |
59 |
{ |
{ |
76 |
*/ |
*/ |
77 |
|
|
78 |
/** |
/** |
79 |
|
* The hostname of the site requesting authentication |
80 |
|
*/ |
81 |
|
private String host; |
82 |
|
|
83 |
|
/** |
84 |
* InternetAddress of the site requesting authentication |
* InternetAddress of the site requesting authentication |
85 |
*/ |
*/ |
86 |
private InetAddress addr; |
private InetAddress addr; |
162 |
public static PasswordAuthentication |
public static PasswordAuthentication |
163 |
requestPasswordAuthentication(InetAddress addr, int port, String protocol, |
requestPasswordAuthentication(InetAddress addr, int port, String protocol, |
164 |
String prompt, String scheme) |
String prompt, String scheme) |
165 |
|
throws SecurityException |
166 |
|
{ |
167 |
|
return(requestPasswordAuthentication (null, addr, port, protocol, |
168 |
|
prompt, scheme)); |
169 |
|
} |
170 |
|
|
171 |
|
/** |
172 |
|
* @since 1.4 |
173 |
|
*/ |
174 |
|
public static PasswordAuthentication |
175 |
|
requestPasswordAuthentication(String host, InetAddress addr, int port, |
176 |
|
String protocol, String prompt, String scheme) |
177 |
|
throws SecurityException |
178 |
{ |
{ |
179 |
SecurityManager sm = System.getSecurityManager(); |
SecurityManager sm = System.getSecurityManager(); |
180 |
if (sm != null) |
if (sm != null) |
183 |
if (default_authenticator == null) |
if (default_authenticator == null) |
184 |
return(null); |
return(null); |
185 |
|
|
186 |
|
default_authenticator.host = host; |
187 |
default_authenticator.addr = addr; |
default_authenticator.addr = addr; |
188 |
default_authenticator.port = port; |
default_authenticator.port = port; |
189 |
default_authenticator.protocol = protocol; |
default_authenticator.protocol = protocol; |
193 |
return(default_authenticator.getPasswordAuthentication()); |
return(default_authenticator.getPasswordAuthentication()); |
194 |
} |
} |
195 |
|
|
196 |
|
/** |
197 |
|
* @since 1.4 |
198 |
|
*/ |
199 |
|
protected final String getRequestingHost() |
200 |
|
{ |
201 |
|
return(host); |
202 |
|
} |
203 |
|
|
204 |
/*************************************************************************/ |
/*************************************************************************/ |
205 |
|
|
206 |
/* |
/* |