You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2007/03/21 15:49:55 UTC
svn commit: r520904 - in
/incubator/servicemix/trunk/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/xfire:
JbiChannel.java JbiProxy.java JbiProxyFactoryBean.java
Author: gnodet
Date: Wed Mar 21 07:49:54 2007
New Revision: 520904
URL: http://svn.apache.org/viewvc?view=rev&rev=520904
Log:
SM-980: Security Subject can not be propagated in servicemix-jsr181 when using the jsr181 proxies
Modified:
incubator/servicemix/trunk/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/xfire/JbiChannel.java
incubator/servicemix/trunk/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/xfire/JbiProxy.java
incubator/servicemix/trunk/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/xfire/JbiProxyFactoryBean.java
Modified: incubator/servicemix/trunk/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/xfire/JbiChannel.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/xfire/JbiChannel.java?view=diff&rev=520904&r1=520903&r2=520904
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/xfire/JbiChannel.java (original)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/xfire/JbiChannel.java Wed Mar 21 07:49:54 2007
@@ -24,6 +24,7 @@
import javax.jbi.messaging.DeliveryChannel;
import javax.jbi.messaging.ExchangeStatus;
import javax.jbi.messaging.InOut;
+import javax.jbi.messaging.MessageExchange;
import javax.jbi.messaging.MessageExchangeFactory;
import javax.jbi.messaging.NormalizedMessage;
import javax.jbi.servicedesc.ServiceEndpoint;
@@ -35,6 +36,7 @@
import org.apache.servicemix.jbi.jaxp.StAXSourceTransformer;
import org.apache.servicemix.jbi.jaxp.StringSource;
+import org.apache.servicemix.jsr181.JBIContext;
import org.codehaus.xfire.MessageContext;
import org.codehaus.xfire.XFireException;
import org.codehaus.xfire.exchange.InMessage;
@@ -55,6 +57,7 @@
public static final String JBI_INTERFACE_NAME = "jbi.interface";
public static final String JBI_SERVICE_NAME = "jbi.service";
public static final String JBI_ENDPOINT = "jbi.endpoint";
+ public static final String JBI_SECURITY_PROPAGATATION = "jbi.security.propagation";
private static ThreadLocal transformer = new ThreadLocal();
@@ -100,6 +103,13 @@
me.setEndpoint((ServiceEndpoint) context.getService().getProperty(JBI_ENDPOINT));
NormalizedMessage msg = me.createMessage();
me.setInMessage(msg);
+ if (Boolean.TRUE.equals(context.getService().getProperty(JBI_SECURITY_PROPAGATATION))) {
+ MessageExchange oldMe = JBIContext.getMessageExchange();
+ NormalizedMessage oldMsg = (oldMe != null) ? oldMe.getMessage("in") : null;
+ if (oldMsg != null) {
+ msg.setSecuritySubject(oldMsg.getSecuritySubject());
+ }
+ }
msg.setContent(getContent(context, message));
if (!channel.sendSync(me)) {
throw new XFireException("Unable to send jbi exchange: sendSync returned false");
Modified: incubator/servicemix/trunk/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/xfire/JbiProxy.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/xfire/JbiProxy.java?view=diff&rev=520904&r1=520903&r2=520904
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/xfire/JbiProxy.java (original)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/xfire/JbiProxy.java Wed Mar 21 07:49:54 2007
@@ -68,6 +68,7 @@
protected Class serviceClass;
protected Definition description;
protected ServiceEndpoint endpoint;
+ protected boolean propagateSecurityContext;
public static Object create(XFire xfire,
ComponentContext context,
@@ -79,6 +80,17 @@
return p.getProxy();
}
+ public static Object create(XFire xfire,
+ ComponentContext context,
+ QName interfaceName,
+ QName serviceName,
+ String endpointName,
+ Class serviceClass,
+ boolean propagateSecurityContext) throws Exception {
+ JbiProxy p = new JbiProxy(xfire, context, serviceClass, interfaceName, serviceName, endpointName, propagateSecurityContext);
+ return p.getProxy();
+ }
+
public JbiProxy(XFire xfire,
ComponentContext context,
Class serviceClass,
@@ -103,6 +115,22 @@
this.serviceClass = serviceClass;
}
+ public JbiProxy(XFire xfire,
+ ComponentContext context,
+ Class serviceClass,
+ QName interfaceName,
+ QName serviceName,
+ String endpointName,
+ boolean propagateSecurityContext) throws Exception {
+ this.xfire = xfire;
+ this.context = context;
+ this.interfaceName = interfaceName;
+ this.serviceName = serviceName;
+ this.endpointName = endpointName;
+ this.serviceClass = serviceClass;
+ this.propagateSecurityContext = propagateSecurityContext;
+ }
+
public Object getProxy() throws Exception {
if (proxy == null) {
Map props = new HashMap();
@@ -124,6 +152,7 @@
if (endpoint != null) {
client.getService().setProperty(JbiChannel.JBI_ENDPOINT, endpoint);
}
+ client.getService().setProperty(JbiChannel.JBI_SECURITY_PROPAGATATION, Boolean.valueOf(propagateSecurityContext));
XFireProxyFactory xpf = new XFireProxyFactory(xfire);
proxy = xpf.create(client);
}
Modified: incubator/servicemix/trunk/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/xfire/JbiProxyFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/xfire/JbiProxyFactoryBean.java?view=diff&rev=520904&r1=520903&r2=520904
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/xfire/JbiProxyFactoryBean.java (original)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/xfire/JbiProxyFactoryBean.java Wed Mar 21 07:49:54 2007
@@ -58,6 +58,7 @@
private QName service;
private QName interfaceName;
private String endpoint;
+ private boolean propagateSecuritySubject;
private ServiceMixClient client;
@@ -80,7 +81,7 @@
synchronized private InvocationHandler getJBIInvocationHandler() throws Exception {
if( jbiInvocationHandler == null ) {
XFire xfire = Jsr181Component.createXFire(getInternalContext());
- Object o = JbiProxy.create(xfire, context, interfaceName, service, endpoint, type);
+ Object o = JbiProxy.create(xfire, context, interfaceName, service, endpoint, type, propagateSecuritySubject);
jbiInvocationHandler = Proxy.getInvocationHandler(o);
}
return jbiInvocationHandler;
@@ -195,6 +196,20 @@
*/
public void setName(String name) {
this.name = name;
+ }
+
+ /**
+ * @return the propagateSecuritySubject
+ */
+ public boolean isPropagateSecuritySubject() {
+ return propagateSecuritySubject;
+ }
+
+ /**
+ * @param propagateSecuritySubject the propagateSecuritySubject to set
+ */
+ public void setPropagateSecuritySubject(boolean propagateSecuritySubject) {
+ this.propagateSecuritySubject = propagateSecuritySubject;
}
public void afterPropertiesSet() throws Exception {