if (session != null){
String realm = getRequestingPrompt();
String scheme = getRequestingScheme();
logger.info("realm=" + realm + "; getRequestingScheme()=" + scheme);
RequestCredentials credentials = session.getMatchingCredentials(realm, scheme);
if (credentials != null){
logger.info("Using credentials supplied: " + credentials);
return new PasswordAuthentication(credentials.username(),
credentials.password().toCharArray());
}
logger.fine("No credentials found. Should get prompt on browser.");
}
return null;
}