You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2010/05/27 14:56:14 UTC
svn commit: r948817 -
/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java
Author: ningjiang
Date: Thu May 27 12:56:14 2010
New Revision: 948817
URL: http://svn.apache.org/viewvc?rev=948817&view=rev
Log:
CAMEL-2757 fix the camel-cxf unit test failures
Modified:
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java
Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java?rev=948817&r1=948816&r2=948817&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java (original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java Thu May 27 12:56:14 2010
@@ -220,6 +220,14 @@ public class DefaultCxfBinding implement
Message cxfMessage = cxfExchange.getInMessage();
propagateHeadersFromCxfToCamel(cxfMessage, camelExchange.getIn(), camelExchange);
+ // propagate the security subject from CXF security context
+ SecurityContext securityContext = cxfMessage.get(SecurityContext.class);
+ if (securityContext != null && securityContext.getUserPrincipal() != null) {
+ Subject subject = new Subject();
+ subject.getPrincipals().add(securityContext.getUserPrincipal());
+ camelExchange.getIn().getHeaders().put(Exchange.AUTHENTICATION, subject);
+ }
+
// Propagating properties from CXF Exchange to Camel Exchange has an
// side effect of copying reply side stuff when the producer is retried.
// So, we do not want to do this.
@@ -466,15 +474,7 @@ public class DefaultCxfBinding implement
} else {
((List<?>)value).clear();
}
- }
-
- // propagate the security subject from CXF security context
- SecurityContext securityContext = cxfMessage.get(SecurityContext.class);
- if (securityContext != null) {
- Subject subject = new Subject();
- subject.getPrincipals().add(securityContext.getUserPrincipal());
- camelHeaders.put(Exchange.AUTHENTICATION, subject);
- }
+ }
}
@SuppressWarnings("unchecked")