// API ******************************************************************
// Overriding Authenticator *********************************************
protected PasswordAuthentication getPasswordAuthentication() {
PasswordAuthentication result = null;
if (isProxyAuthentication()) {
String proxyUser = System.getProperty("http.proxyUser");
if ((proxyUser != null) && (proxyUser.trim().length() > 0)) {
String proxyPass = System.getProperty("http.proxyPassword", "");
Message.debug("authenicating to proxy server with username [" + proxyUser + "]");
result = new PasswordAuthentication(proxyUser, proxyPass.toCharArray());
}
} else {
Credentials c = CredentialsStore.INSTANCE.getCredentials(getRequestingPrompt(),
getRequestingHost());
Message.debug("authentication: k='"
+ Credentials.buildKey(getRequestingPrompt(), getRequestingHost()) + "' c='"
+ c + "'");
if (c != null) {
final String password = c.getPasswd() == null ? "" : c.getPasswd();
result = new PasswordAuthentication(c.getUserName(), password.toCharArray());
}
}
if ((result == null) && (original != null)) {
Authenticator.setDefault(original);