diff --git a/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/OSGiCredentialsProvider.java b/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/OSGiCredentialsProvider.java index f2af64011..e9d6e5147 100644 --- a/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/OSGiCredentialsProvider.java +++ b/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/OSGiCredentialsProvider.java @@ -72,11 +72,9 @@ final class OSGiCredentialsProvider implements CredentialsProvider { final ProxyConfiguration proxyConfiguration = (ProxyConfiguration) proxyConfigurationObject; if (proxyConfiguration.isEnabled()) { final AuthScope actual = new AuthScope(proxyConfiguration.getHostname(), proxyConfiguration.getPort()); - if (authscope.equals(actual)) { - return new UsernamePasswordCredentials(proxyConfiguration.getUsername(), - proxyConfiguration.getPassword()); + if (authscope.match(actual) >= 12) { + return new UsernamePasswordCredentials(proxyConfiguration.getUsername(), proxyConfiguration.getPassword()); } - } } } diff --git a/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/OSGiProxyConfiguration.java b/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/OSGiProxyConfiguration.java index 00ae3a0be..a132c735a 100644 --- a/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/OSGiProxyConfiguration.java +++ b/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/OSGiProxyConfiguration.java @@ -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 = ""; diff --git a/httpclient-osgi/src/test/java/org/apache/http/osgi/impl/OSGiProxyConfigurationTest.java b/httpclient-osgi/src/test/java/org/apache/http/osgi/impl/OSGiProxyConfigurationTest.java index 55b117497..57505f6b2 100644 --- a/httpclient-osgi/src/test/java/org/apache/http/osgi/impl/OSGiProxyConfigurationTest.java +++ b/httpclient-osgi/src/test/java/org/apache/http/osgi/impl/OSGiProxyConfigurationTest.java @@ -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"});