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:
parent
cb89108e45
commit
cc6a57e04a
|
@ -82,6 +82,20 @@ public class SystemDefaultCredentialsProvider implements CredentialsProvider {
|
||||||
internal.setCredentials(authscope, credentials);
|
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) {
|
public Credentials getCredentials(final AuthScope authscope) {
|
||||||
Args.notNull(authscope, "Auth scope");
|
Args.notNull(authscope, "Auth scope");
|
||||||
final Credentials localcreds = internal.getCredentials(authscope);
|
final Credentials localcreds = internal.getCredentials(authscope);
|
||||||
|
@ -89,13 +103,7 @@ public class SystemDefaultCredentialsProvider implements CredentialsProvider {
|
||||||
return localcreds;
|
return localcreds;
|
||||||
}
|
}
|
||||||
if (authscope.getHost() != null) {
|
if (authscope.getHost() != null) {
|
||||||
final PasswordAuthentication systemcreds = Authenticator.requestPasswordAuthentication(
|
final PasswordAuthentication systemcreds = getSystemCreds(authscope, null);
|
||||||
authscope.getHost(),
|
|
||||||
null,
|
|
||||||
authscope.getPort(),
|
|
||||||
"http",
|
|
||||||
null,
|
|
||||||
translateScheme(authscope.getScheme()));
|
|
||||||
if (systemcreds != null) {
|
if (systemcreds != null) {
|
||||||
return new UsernamePasswordCredentials(
|
return new UsernamePasswordCredentials(
|
||||||
systemcreds.getUserName(), new String(systemcreds.getPassword()));
|
systemcreds.getUserName(), new String(systemcreds.getPassword()));
|
||||||
|
|
Loading…
Reference in New Issue