The authSupplier property is ignored in case of OSGi http conduit configuration
@@ -37,6 +37,7 @@ import org.apache.cxf.configuration.security.ProxyAuthorizationPolicy;
import org.apache.cxf.configuration.security.SecureRandomParameters;
import org.apache.cxf.configuration.security.TrustManagersType;
import org.apache.cxf.transport.http.HTTPConduit;
+import org.apache.cxf.transport.http.auth.HttpAuthSupplier;
import org.apache.cxf.transports.http.configuration.ConnectionType;
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
import org.apache.cxf.transports.http.configuration.ProxyServerType;
@@ -57,6 +58,7 @@ class HttpConduitConfigApplier {
if (address != null && address.startsWith(SECURE_HTTP_PREFIX)) {
applyTlsClientParameters(d, c);
}
+ applyAuthSupplier(d, c);
}
private void applyTlsClientParameters(Dictionary<String, String> d, HTTPConduit c) {
@@ -351,4 +353,27 @@ class HttpConduitConfigApplier {
}
}
}
+
+ private void applyAuthSupplier(Dictionary<String, String> d, HTTPConduit c) {
+ Enumeration<String> keys = d.keys();
+ while (keys.hasMoreElements()) {
+ String k = keys.nextElement();
+ if (k.startsWith("authSupplier")) {
+ String v = d.get(k);
+ Object obj;
+ try {
+ obj = Class.forName(v).newInstance();
+ } catch (InstantiationException e) {
+ throw new RuntimeException(e);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException(e);
+ }
+ if (obj instanceof HttpAuthSupplier) {
+ c.setAuthSupplier((HttpAuthSupplier)obj);
+ }
+ }
+ }
+ }
}
