HTTPCLIENT-1412: SystemDefaultCredentialsProvider doesn't specify RequestorType.PROXY for proxy authentication requests

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1529291 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2013-10-04 20:45:22 +00:00
parent cb89108e45
commit cc6a57e04a
1 changed files with 15 additions and 7 deletions

View File

@ -82,6 +82,20 @@ public class SystemDefaultCredentialsProvider implements CredentialsProvider {
internal.setCredentials(authscope, credentials);
}
private static PasswordAuthentication getSystemCreds(
final AuthScope authscope,
final Authenticator.RequestorType requestorType) {
return Authenticator.requestPasswordAuthentication(
authscope.getHost(),
null,
authscope.getPort(),
"http",
null,
translateScheme(authscope.getScheme()),
null,
requestorType);
}
public Credentials getCredentials(final AuthScope authscope) {
Args.notNull(authscope, "Auth scope");
final Credentials localcreds = internal.getCredentials(authscope);
@ -89,13 +103,7 @@ public class SystemDefaultCredentialsProvider implements CredentialsProvider {
return localcreds;
}
if (authscope.getHost() != null) {
final PasswordAuthentication systemcreds = Authenticator.requestPasswordAuthentication(
authscope.getHost(),
null,
authscope.getPort(),
"http",
null,
translateScheme(authscope.getScheme()));
final PasswordAuthentication systemcreds = getSystemCreds(authscope, null);
if (systemcreds != null) {
return new UsernamePasswordCredentials(
systemcreds.getUserName(), new String(systemcreds.getPassword()));