if (credentials!=null){
return credentials;
}
try {
if (scope.getScheme().equals("ntlm")) {
AuthenticationDialog pwDialog = new AuthenticationDialog(
ownerFrame, "Authentication Required",
"<html>Host <b>" + scope.getHost() + ":" + scope.getPort()
+ "</b> requires Windows authentication</html>", true);
pwDialog.setVisible(true);
if (pwDialog.getUser().length() > 0) {
credentials = new NTCredentials(
pwDialog.getUser(),
pwDialog.getPassword(),
scope.getHost(),
pwDialog.getDomain());
}
pwDialog.dispose();
} else if (scope.getScheme().equals("basic")
|| scope.getScheme().equals("digest")) {
//authscheme instanceof RFC2617Scheme
AuthenticationDialog pwDialog = new AuthenticationDialog(
ownerFrame, "Authentication Required",
"<html><center>Host <b>" + scope.getHost() + ":" + scope.getPort() + "</b>"
+ " requires authentication for the realm:<br><b>" + scope.getRealm()
+ "</b></center></html>", false);
pwDialog.setVisible(true);
if (pwDialog.getUser().length() > 0) {
credentials = new UsernamePasswordCredentials(pwDialog.getUser(), pwDialog.getPassword());
}
pwDialog.dispose();
} else {
throw new InvalidCredentialsException(
"Unsupported authentication scheme: " + scope.getScheme());
}
if (credentials != null){