You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ff...@apache.org on 2017/09/19 08:21:44 UTC

[cxf] branch 3.1.x-fixes updated: CXF-7509 The authSupplier property is ignored in case of OSGi http conduit configuration

This is an automated email from the ASF dual-hosted git repository.

ffang pushed a commit to branch 3.1.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/3.1.x-fixes by this push:
     new 90623ef  CXF-7509 The authSupplier property is ignored in case of OSGi http conduit configuration
90623ef is described below

commit 90623effb45be5c7c14108308e5c0b566e7d2438
Author: xldai <xl...@talend.com>
AuthorDate: Tue Sep 19 15:54:35 2017 +0800

    CXF-7509 The authSupplier property is ignored in case of OSGi http conduit configuration
    
    (cherry picked from commit 69496aa2f74b464f54e88f8f2bcf8b6c444695d3)
---
 .../http/osgi/HttpConduitConfigApplier.java        | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/osgi/HttpConduitConfigApplier.java b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/osgi/HttpConduitConfigApplier.java
index b35c978..35357de 100644
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/osgi/HttpConduitConfigApplier.java
+++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/osgi/HttpConduitConfigApplier.java
@@ -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);
+                }
+            }
+        }
+    }
 }

-- 
To stop receiving notification emails like this one, please contact
['"commits@cxf.apache.org" <co...@cxf.apache.org>'].