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/trunk@1730838 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8e8cfc41ad
commit
129fc09f42
|
@ -72,12 +72,11 @@ final class OSGiCredentialsProvider implements CredentialsStore {
|
|||
final ProxyConfiguration proxyConfiguration = (ProxyConfiguration) proxyConfigurationObject;
|
||||
if (proxyConfiguration.isEnabled()) {
|
||||
final AuthScope actual = new AuthScope(proxyConfiguration.getHostname(), proxyConfiguration.getPort());
|
||||
if (authscope.equals(actual)) {
|
||||
if (authscope.match(actual) >= 12) {
|
||||
final String username = proxyConfiguration.getUsername();
|
||||
final String password = proxyConfiguration.getPassword();
|
||||
return new UsernamePasswordCredentials(username, password != null ? password.toCharArray() : null);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ public final class OSGiProxyConfiguration implements ProxyConfiguration {
|
|||
/**
|
||||
* 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 = "";
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ public class OSGiProxyConfigurationTest {
|
|||
config.put("proxy.enabled", false);
|
||||
config.put("proxy.host", "h");
|
||||
config.put("proxy.port", 1);
|
||||
config.put("proxy.username", "u");
|
||||
config.put("proxy.user", "u");
|
||||
config.put("proxy.password", "p");
|
||||
config.put("proxy.exceptions", new String[]{"e"});
|
||||
|
||||
|
|
Loading…
Reference in New Issue