camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject [1/2] git commit: CAMEL-7145 Added username, password options on cxf endpoint for basic authentication
Date Wed, 22 Jan 2014 03:47:57 GMT
Updated Branches:
  refs/heads/camel-2.11.x 9f418970e -> 91949901a
  refs/heads/camel-2.12.x 1b453ee96 -> db6383343


CAMEL-7145 Added username, password options on cxf endpoint for basic authentication

Conflicts:
	components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/db638334
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/db638334
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/db638334

Branch: refs/heads/camel-2.12.x
Commit: db638334330a25d6e336823738beb7bc6c87e0ed
Parents: 1b453ee
Author: Willem Jiang <willem.jiang@gmail.com>
Authored: Wed Jan 22 11:29:10 2014 +0800
Committer: Willem Jiang <willem.jiang@gmail.com>
Committed: Wed Jan 22 11:33:09 2014 +0800

----------------------------------------------------------------------
 .../apache/camel/component/cxf/CxfEndpoint.java | 28 ++++++++++++++++++++
 1 file changed, 28 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/db638334/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
index c46352b..005428f 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
@@ -67,6 +67,7 @@ import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.common.injection.ResourceInjector;
 import org.apache.cxf.common.util.ClassHelper;
 import org.apache.cxf.common.util.ModCountCopyOnWriteArrayList;
+import org.apache.cxf.configuration.security.AuthorizationPolicy;
 import org.apache.cxf.databinding.DataBinding;
 import org.apache.cxf.databinding.source.SourceDataBinding;
 import org.apache.cxf.endpoint.Client;
@@ -158,6 +159,9 @@ public class CxfEndpoint extends DefaultEndpoint implements HeaderFilterStrategy
     private ReflectionServiceFactoryBean serviceFactoryBean;
     private CxfEndpointConfigurer configurer;
     
+    // basic authentication option for the CXF client
+    private String username;
+    private String password;
 
     public CxfEndpoint() {
     }
@@ -491,6 +495,14 @@ public class CxfEndpoint extends DefaultEndpoint implements HeaderFilterStrategy
             LOG.debug("ClientFactoryBean: {} added properties: {}", factoryBean, getProperties());
         }
         
+        // setup the basic authentication property
+        if (ObjectHelper.isNotEmpty(username)) {
+            AuthorizationPolicy authPolicy = new AuthorizationPolicy();
+            authPolicy.setUserName(username);
+            authPolicy.setPassword(password);
+            factoryBean.getProperties().put(AuthorizationPolicy.class.getName(), authPolicy);
+        }
+        
         if (this.isSkipPayloadMessagePartCheck()) {
             if (factoryBean.getProperties() == null) {
                 factoryBean.setProperties(new HashMap<String, Object>());         
      
@@ -896,6 +908,22 @@ public class CxfEndpoint extends DefaultEndpoint implements HeaderFilterStrategy
     public boolean isMtomEnabled() {
         return mtomEnabled;
     }
+    
+    public String getPassword() {
+        return password;
+    }
+    
+    public void setPassword(String password) {
+        this.password = password;
+    }
+    
+    public String getUsername() {
+        return username;
+    }
+    
+    public void setUsername(String username) {
+        this.username = username;
+    }
 
     /**
      * We need to override the {@link ClientImpl#setParameters} method


Mime
View raw message