servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r718855 - in /servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src: main/java/org/apache/servicemix/cxfbc/interceptors/ test/java/org/apache/servicemix/cxfbc/ws/security/ test/resources/org/apache/serv...
Date Wed, 19 Nov 2008 04:53:07 GMT
Author: ffang
Date: Tue Nov 18 20:53:06 2008
New Revision: 718855

URL: http://svn.apache.org/viewvc?rev=718855&view=rev
Log:
[SM-1696]cxf bc with ws-security can't work with enable JDBCAuditor

Modified:
    servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInInterceptor.java
    servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/security/CxfBCSecurityTest.java
    servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/xbean.xml

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInInterceptor.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInInterceptor.java?rev=718855&r1=718854&r2=718855&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInInterceptor.java
(original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInInterceptor.java
Tue Nov 18 20:53:06 2008
@@ -28,6 +28,7 @@
 import javax.jbi.messaging.MessagingException;
 import javax.jbi.messaging.NormalizedMessage;
 import javax.security.auth.Subject;
+import javax.xml.namespace.QName;
 import javax.xml.transform.Source;
 
 import org.apache.cxf.binding.soap.SoapMessage;
@@ -170,9 +171,20 @@
             message = (SoapMessage) soapMessage;
         }
         Map<String, Object> headers = new HashMap<String, Object>();
+        QName excludeName = new QName(
+                "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd",
+                "Security");
         for (Header header : message.getHeaders()) {
-            headers.put(QNameUtil.toString(header.getName()), header
+            if (!header.getName().equals(excludeName)) {
+                // We must exclude this security header since in Sun's SAAJ impl, the ElementImpl
+                // has a field which doesn't implement Serializable interface, which will
cause
+                //java.io.NotSerializableException when we try to serialize the JBI message.
+                // And this security header isn't necessary inside jbi container since we
have already
+                // delegate the AA to JAAS at this stage.
+                // SM-1696 track this issue
+                headers.put(QNameUtil.toString(header.getName()), header
                     .getObject());
+            }
         }
 
         normalizedMessage.setProperty(JbiConstants.PROTOCOL_HEADERS, headers);

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/security/CxfBCSecurityTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/security/CxfBCSecurityTest.java?rev=718855&r1=718854&r2=718855&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/security/CxfBCSecurityTest.java
(original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/security/CxfBCSecurityTest.java
Tue Nov 18 20:53:06 2008
@@ -16,6 +16,9 @@
  */
 package org.apache.servicemix.cxfbc.ws.security;
 
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.logging.Logger;
 
 import org.apache.cxf.Bus;
@@ -24,16 +27,21 @@
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.interceptor.LoggingInInterceptor;
 import org.apache.cxf.interceptor.LoggingOutInterceptor;
+import org.apache.cxf.testutil.common.ServerLauncher;
 import org.apache.hello_world_soap_http.Greeter;
+import org.apache.servicemix.cxfbc.EmbededJMSBrokerLauncher;
 import org.apache.servicemix.tck.SpringTestSupport;
 import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
 import org.springframework.context.support.AbstractXmlApplicationContext;
 
 public class CxfBCSecurityTest extends SpringTestSupport {
 
+    protected static boolean serversStarted;
     private static final Logger LOG = LogUtils.getL7dLogger(CxfBCSecurityTest.class);
-    
     private static final java.net.URL WSDL_LOC;
+       
+    private ServerLauncher sl;
+    private ServerLauncher embeddedLauncher;
     static {
         java.net.URL tmp = null;
         try {
@@ -46,6 +54,57 @@
         WSDL_LOC = tmp;
     }
     
+    public void startServers() throws Exception {
+        if (serversStarted) {
+            return;
+        }
+        Map<String, String> props = new HashMap<String, String>();          
     
+        if (System.getProperty("activemq.store.dir") != null) {
+            props.put("activemq.store.dir", System.getProperty("activemq.store.dir"));
+        }
+        props.put("java.util.logging.config.file", 
+                  System.getProperty("java.util.logging.config.file"));
+        
+        assertTrue("server did not launch correctly", 
+                   launchServer(EmbededJMSBrokerLauncher.class, props, false));
+        embeddedLauncher =  sl;
+        
+        
+        serversStarted = true;
+    }
+    
+    protected void setUp() throws Exception {
+        startServers();
+        super.setUp();
+            
+    }
+    
+    protected void tearDown() throws Exception {
+        try {
+            embeddedLauncher.stopServer();         
+        } catch (IOException ex) {
+            ex.printStackTrace();
+            fail("failed to stop server " + embeddedLauncher.getClass());
+        }
+        
+        serversStarted = false;
+    }
+    
+    public boolean launchServer(Class<?> clz, Map<String, String> p, boolean
inProcess) {
+        boolean ok = false;
+        try { 
+            sl = new ServerLauncher(clz.getName(), p, null, inProcess);
+            ok = sl.launchServer();
+            assertTrue("server failed to launch", ok);
+            
+        } catch (IOException ex) {
+            ex.printStackTrace();
+            fail("failed to launch server " + clz);
+        }
+        
+        return ok;
+    }
+    
     public void testTimestampSignEncrypt() {
         LOG.info("test security");
         Bus bus = new SpringBusFactory().createBus(

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/xbean.xml
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/xbean.xml?rev=718855&r1=718854&r2=718855&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/xbean.xml
(original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/xbean.xml
Tue Nov 18 20:53:06 2008
@@ -22,7 +22,7 @@
        xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"
        xmlns:greeter="http://apache.org/hello_world_soap_http">
   
-  <sm:container id="jbi" embedded="true">
+  <sm:container id="jbi" embedded="true" flowNames="jms?jmsURL=tcp://localhost:61616">
     
     <sm:endpoints>
       <cxfse:endpoint>



Mime
View raw message