HTTPCLIENT-1718, HTTPCLEINT-1719: credentials fix to allow proxy authetication
Contributed by 212427891 <munene.kiruja at ge.com> git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1730836 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3cde2e432d
commit
96c4a55029
|
@ -72,11 +72,9 @@ final class OSGiCredentialsProvider implements CredentialsProvider {
|
||||||
final ProxyConfiguration proxyConfiguration = (ProxyConfiguration) proxyConfigurationObject;
|
final ProxyConfiguration proxyConfiguration = (ProxyConfiguration) proxyConfigurationObject;
|
||||||
if (proxyConfiguration.isEnabled()) {
|
if (proxyConfiguration.isEnabled()) {
|
||||||
final AuthScope actual = new AuthScope(proxyConfiguration.getHostname(), proxyConfiguration.getPort());
|
final AuthScope actual = new AuthScope(proxyConfiguration.getHostname(), proxyConfiguration.getPort());
|
||||||
if (authscope.equals(actual)) {
|
if (authscope.match(actual) >= 12) {
|
||||||
return new UsernamePasswordCredentials(proxyConfiguration.getUsername(),
|
return new UsernamePasswordCredentials(proxyConfiguration.getUsername(), proxyConfiguration.getPassword());
|
||||||
proxyConfiguration.getPassword());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ public final class OSGiProxyConfiguration implements ProxyConfiguration {
|
||||||
/**
|
/**
|
||||||
* Property representing the username to authenticate with towards the proxy. Defaults to empty.
|
* Property representing the username to authenticate with towards the proxy. Defaults to empty.
|
||||||
*/
|
*/
|
||||||
private static final String PROPERTYNAME_PROXY_USERNAME = "proxy.username";
|
private static final String PROPERTYNAME_PROXY_USERNAME = "proxy.user";
|
||||||
|
|
||||||
private static final String PROPERTYDEFAULT_PROXY_USERNAME = "";
|
private static final String PROPERTYDEFAULT_PROXY_USERNAME = "";
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class OSGiProxyConfigurationTest {
|
||||||
config.put("proxy.enabled", false);
|
config.put("proxy.enabled", false);
|
||||||
config.put("proxy.host", "h");
|
config.put("proxy.host", "h");
|
||||||
config.put("proxy.port", 1);
|
config.put("proxy.port", 1);
|
||||||
config.put("proxy.username", "u");
|
config.put("proxy.user", "u");
|
||||||
config.put("proxy.password", "p");
|
config.put("proxy.password", "p");
|
||||||
config.put("proxy.exceptions", new String[]{"e"});
|
config.put("proxy.exceptions", new String[]{"e"});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue