You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2017/01/20 16:54:40 UTC

[1/4] cxf git commit: Removing unused config

Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 8d8ae785a -> 8a43e828c


Removing unused config


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

Branch: refs/heads/3.0.x-fixes
Commit: d9a86780898c9d345dc07c614f247313bc1f4380
Parents: 8d8ae78
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Fri Jan 20 11:57:35 2017 +0000
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Fri Jan 20 16:22:26 2017 +0000

----------------------------------------------------------------------
 .../org/apache/cxf/systest/ws/action/server.xml | 52 ----------
 .../cxf/systest/ws/action/signature-server.xml  | 99 --------------------
 2 files changed, 151 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/d9a86780/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/server.xml
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/server.xml b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/server.xml
index 0d2f8a5..1d45840 100644
--- a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/server.xml
+++ b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/server.xml
@@ -125,58 +125,6 @@
         </jaxws:inInterceptors>
     </jaxws:endpoint>
     
-    <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt" id="Signature" address="http://localhost:${testutil.ports.action.Server}/DoubleItSignature" serviceName="s:DoubleItService" endpointName="s:DoubleItSignaturePort" implementor="org.apache.cxf.systest.ws.common.DoubleItImpl" wsdlLocation="org/apache/cxf/systest/ws/action/DoubleItAction.wsdl">
-        <jaxws:outInterceptors>
-            <bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
-                <constructor-arg>
-                    <map>
-                        <entry key="action" value="Signature"/>
-                        <entry key="signatureUser" value="bob"/>
-                        <entry key="signaturePropFile" value="bob.properties"/>
-                        <entry key="signatureKeyIdentifier" value="DirectReference"/>
-                        <entry key="passwordCallbackClass" value="org.apache.cxf.systest.ws.common.KeystorePasswordCallback"/>
-                    </map>
-                </constructor-arg>
-            </bean>
-        </jaxws:outInterceptors>
-        <jaxws:inInterceptors>
-            <bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
-                <constructor-arg>
-                    <map>
-                        <entry key="action" value="Signature"/>
-                        <entry key="signatureVerificationPropFile" value="bob.properties"/>
-                    </map>
-                </constructor-arg>
-            </bean>
-        </jaxws:inInterceptors>
-    </jaxws:endpoint>
-    
-    <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt" id="Signature2" address="http://localhost:${testutil.ports.action.Server}/DoubleItSignature2" serviceName="s:DoubleItService" endpointName="s:DoubleItSignaturePort2" implementor="org.apache.cxf.systest.ws.common.DoubleItImpl" wsdlLocation="org/apache/cxf/systest/ws/action/DoubleItAction.wsdl">
-        <jaxws:outInterceptors>
-            <bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
-                <constructor-arg>
-                    <map>
-                        <entry key="action" value="Signature"/>
-                        <entry key="signatureUser" value="bob"/>
-                        <entry key="signaturePropFile" value="bob.properties"/>
-                        <entry key="signatureKeyIdentifier" value="DirectReference"/>
-                        <entry key="passwordCallbackClass" value="org.apache.cxf.systest.ws.common.KeystorePasswordCallback"/>
-                    </map>
-                </constructor-arg>
-            </bean>
-        </jaxws:outInterceptors>
-        <jaxws:inInterceptors>
-            <bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
-                <constructor-arg>
-                    <map>
-                        <entry key="action" value="Signature"/>
-                        <entry key="signatureVerificationPropFile" value="bob.properties"/>
-                    </map>
-                </constructor-arg>
-            </bean>
-        </jaxws:inInterceptors>
-    </jaxws:endpoint>
-    
     <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt" id="Asymmetric" address="http://localhost:${testutil.ports.action.Server}/DoubleItAsymmetric" serviceName="s:DoubleItService" endpointName="s:DoubleItAsymmetricPort" implementor="org.apache.cxf.systest.ws.common.DoubleItImpl" wsdlLocation="org/apache/cxf/systest/ws/action/DoubleItActionPolicy.wsdl">
         <jaxws:properties>
             <entry key="ws-security.callback-handler" value="org.apache.cxf.systest.ws.common.KeystorePasswordCallback"/>

http://git-wip-us.apache.org/repos/asf/cxf/blob/d9a86780/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/signature-server.xml
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/signature-server.xml b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/signature-server.xml
index 8b917dc..4ba1e50 100644
--- a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/signature-server.xml
+++ b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/signature-server.xml
@@ -25,105 +25,6 @@
             <cxf:logging/>
         </cxf:features>
     </cxf:bus>
-    <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt" id="TripleDESEncryption" address="http://localhost:${testutil.ports.SignatureServer}/DoubleIt3DESEncryption" serviceName="s:DoubleItService" endpointName="s:DoubleIt3DESEncryptionPort" implementor="org.apache.cxf.systest.ws.common.DoubleItImpl" wsdlLocation="org/apache/cxf/systest/ws/action/DoubleItAction.wsdl">
-        <jaxws:outInterceptors>
-            <bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
-                <constructor-arg>
-                    <map>
-                        <entry key="action" value="Encrypt"/>
-                        <entry key="passwordCallbackClass" value="org.apache.cxf.systest.ws.action.SecretKeyPasswordCallback"/>
-                        <entry key="encryptSymmetricEncryptionKey" value="false"/>
-                        <entry key="encryptionSymAlgorithm" value="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/>
-                    </map>
-                </constructor-arg>
-            </bean>
-        </jaxws:outInterceptors>
-        <jaxws:inInterceptors>
-            <bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
-                <constructor-arg>
-                    <map>
-                        <entry key="action" value="Encrypt"/>
-                        <entry key="passwordCallbackClass" value="org.apache.cxf.systest.ws.action.SecretKeyPasswordCallback"/>
-                        <entry key="isBSPCompliant" value="false"/>
-                    </map>
-                </constructor-arg>
-            </bean>
-        </jaxws:inInterceptors>
-    </jaxws:endpoint>
-    <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt" id="UsernameToken" address="http://localhost:${testutil.ports.SignatureServer}/DoubleItUsernameToken" serviceName="s:DoubleItService" endpointName="s:DoubleItUsernameTokenPort" implementor="org.apache.cxf.systest.ws.common.DoubleItImpl" wsdlLocation="org/apache/cxf/systest/ws/action/DoubleItAction.wsdl">
-        <jaxws:inInterceptors>
-            <bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
-                <constructor-arg>
-                    <map>
-                        <entry key="action" value="UsernameToken"/>
-                        <entry key="passwordCallbackClass" value="org.apache.cxf.systest.ws.common.UTPasswordCallback"/>
-                    </map>
-                </constructor-arg>
-            </bean>
-        </jaxws:inInterceptors>
-    </jaxws:endpoint>
-    <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt" id="UsernameToken2" address="http://localhost:${testutil.ports.SignatureServer}/DoubleItUsernameToken2" serviceName="s:DoubleItService" endpointName="s:DoubleItUsernameTokenPort2" implementor="org.apache.cxf.systest.ws.common.DoubleItImpl" wsdlLocation="org/apache/cxf/systest/ws/action/DoubleItAction.wsdl">
-        <jaxws:inInterceptors>
-            <bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
-                <constructor-arg>
-                    <map>
-                        <entry key="action" value="UsernameToken"/>
-                        <entry key="passwordCallbackClass" value="org.apache.cxf.systest.ws.common.UTPasswordCallback"/>
-                    </map>
-                </constructor-arg>
-            </bean>
-        </jaxws:inInterceptors>
-    </jaxws:endpoint>
-    <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt" id="EncryptedPassword" address="http://localhost:${testutil.ports.SignatureServer}/DoubleItEncryptedPassword" serviceName="s:DoubleItService" endpointName="s:DoubleItEncryptedPasswordPort" implementor="org.apache.cxf.systest.ws.common.DoubleItImpl" wsdlLocation="org/apache/cxf/systest/ws/action/DoubleItAction.wsdl">
-        <jaxws:outInterceptors>
-            <bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
-                <constructor-arg>
-                    <map>
-                        <entry key="action" value="Encrypt"/>
-                        <entry key="passwordCallbackClass" value="org.apache.cxf.systest.ws.common.KeystorePasswordCallback"/>
-                        <entry key="encryptionPropFile" value="alice-enc.properties"/>
-                        <entry key="encryptionUser" value="alice"/>
-                    </map>
-                </constructor-arg>
-            </bean>
-        </jaxws:outInterceptors>
-        <jaxws:inInterceptors>
-            <bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
-                <constructor-arg>
-                    <map>
-                        <entry key="action" value="Encrypt"/>
-                        <entry key="passwordCallbackClass" value="org.apache.cxf.systest.ws.common.KeystorePasswordCallback"/>
-                        <entry key="decryptionPropFile" value="bob-enc.properties"/>
-                    </map>
-                </constructor-arg>
-            </bean>
-        </jaxws:inInterceptors>
-    </jaxws:endpoint>
-    <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt" id="SignedTimestamp" address="http://localhost:${testutil.ports.SignatureServer}/DoubleItSignedTimestamp" serviceName="s:DoubleItService" endpointName="s:DoubleItSignedTimestampPort" implementor="org.apache.cxf.systest.ws.common.DoubleItImpl" wsdlLocation="org/apache/cxf/systest/ws/action/DoubleItAction.wsdl">
-        <jaxws:outInterceptors>
-            <bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
-                <constructor-arg>
-                    <map>
-                        <entry key="action" value="Signature"/>
-                        <entry key="signatureUser" value="bob"/>
-                        <entry key="signaturePropFile" value="bob.properties"/>
-                        <entry key="signatureKeyIdentifier" value="DirectReference"/>
-                        <entry key="passwordCallbackClass" value="org.apache.cxf.systest.ws.common.KeystorePasswordCallback"/>
-                    </map>
-                </constructor-arg>
-            </bean>
-        </jaxws:outInterceptors>
-        <jaxws:inInterceptors>
-            <bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
-                <constructor-arg>
-                    <map>
-                        <entry key="action" value="Signature Timestamp"/>
-                        <entry key="signatureVerificationPropFile" value="bob.properties"/>
-                    </map>
-                </constructor-arg>
-            </bean>
-        </jaxws:inInterceptors>
-    </jaxws:endpoint>
     
     <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt" id="Signature" address="http://localhost:${testutil.ports.SignatureServer}/DoubleItSignature" serviceName="s:DoubleItService" endpointName="s:DoubleItSignaturePort" implementor="org.apache.cxf.systest.ws.common.DoubleItImpl" wsdlLocation="org/apache/cxf/systest/ws/action/DoubleItAction.wsdl">
         <jaxws:outInterceptors>


[4/4] cxf git commit: Recording .gitmergeinfo Changes

Posted by co...@apache.org.
Recording .gitmergeinfo Changes


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

Branch: refs/heads/3.0.x-fixes
Commit: 8a43e828c510e2fbb9b6bf3fabcb8e2f9027beaf
Parents: 7554fa1
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Fri Jan 20 16:22:28 2017 +0000
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Fri Jan 20 16:22:28 2017 +0000

----------------------------------------------------------------------
 .gitmergeinfo | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/8a43e828/.gitmergeinfo
----------------------------------------------------------------------
diff --git a/.gitmergeinfo b/.gitmergeinfo
index 51a4bfc..b038ee0 100644
--- a/.gitmergeinfo
+++ b/.gitmergeinfo
@@ -1705,6 +1705,7 @@ M cda58270486b4d394b98a1a1a1d5bfcb366af2c1
 M ce6444508e279e9941fdc23f80889f44a27b9d95
 M cf25923774acf5cabb2775da729f9f51d8347e5d
 M cf879076498614de7424fc4ec63e62324e0055a6
+M d1dd736944104a5da648c921381eb3246b9c24f8
 M d25e4c94c518cb79af1e05a32fb8ded52a951324
 M d2b5baa69415ea41f5865a8961c813feead3b22a
 M d2d8f6d6e2773025e0dd1c51c6b5e5d2e721def8
@@ -1731,6 +1732,7 @@ M dc1a867f9527ce3431f097fde27a984b0c3c324e
 M dd1b3ebf5b10651a2220a54a1f6e276d2197acf0
 M de0c559ced241f21a3e8e3ac47ab8941f924472b
 M dfe90b649bee2e7cdd448b16d60b26457385b4e5
+M e0b8a8ad939fcb63e405b7225a147e440da18289
 M e2225709c37cb289b99db015b3d8ba5b9b317615
 M e2ad037fbc74f42655ac968415fcb4bded87bb38
 M e3f89d3c07f38f2e01c951d7bad8336e090837ae


[3/4] cxf git commit: CXF-7220 - WS-Security StaX processing fails on whitespace after the SOAP Body opening tag

Posted by co...@apache.org.
CXF-7220 - WS-Security StaX processing fails on whitespace after the SOAP Body opening tag


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

Branch: refs/heads/3.0.x-fixes
Commit: 7554fa13a32ab484088ed80bca8ac29610884c59
Parents: 2f89d00
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Fri Jan 20 15:41:03 2017 +0000
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Fri Jan 20 16:22:28 2017 +0000

----------------------------------------------------------------------
 .../security/wss4j/WSS4JStaxInInterceptor.java  | 44 ++++++++++++++++++++
 .../ws/action/SignatureWhitespaceTest.java      | 37 +++++++++-------
 2 files changed, 67 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/7554fa13/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JStaxInInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JStaxInInterceptor.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JStaxInInterceptor.java
index 0c82445..74489ed 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JStaxInInterceptor.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JStaxInInterceptor.java
@@ -36,6 +36,8 @@ import javax.xml.stream.util.StreamReaderDelegate;
 
 import org.apache.cxf.binding.soap.SoapFault;
 import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
+import org.apache.cxf.binding.soap.interceptor.StartBodyInterceptor;
 import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
@@ -101,6 +103,8 @@ public class WSS4JStaxInInterceptor extends AbstractWSS4JStaxInterceptor {
         if (soapMessage.containsKey(SECURITY_PROCESSED) || isGET(soapMessage)) {
             return;
         }
+        
+        soapMessage.getInterceptorChain().add(new StaxStartBodyInterceptor());
 
         XMLStreamReader originalXmlStreamReader = soapMessage.getContent(XMLStreamReader.class);
         XMLStreamReader newXmlStreamReader;
@@ -424,6 +428,46 @@ public class WSS4JStaxInInterceptor extends AbstractWSS4JStaxInterceptor {
             throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ex);
         }
     }
+    
+    /**
+     * This interceptor runs after the StartBodyInterceptor. It skips any white space after the SOAP:Body start tag, 
+     * to make sure that the WSS4J OperationInputProcessor is triggered by the first SOAP Body child (if it is not, 
+     * then WS-Security processing does not happen correctly).
+     */
+    private class StaxStartBodyInterceptor extends AbstractSoapInterceptor {
+        
+        StaxStartBodyInterceptor() {
+            super(Phase.READ);
+            super.addAfter(StartBodyInterceptor.class.getName());
+        }
+        
+        StaxStartBodyInterceptor(String phase) {
+            super(phase);
+        }
+
+        /** {@inheritDoc}*/
+        public void handleMessage(SoapMessage message) throws Fault {
+            if (isGET(message)) {
+                LOG.fine("StartBodyInterceptor skipped in HTTP GET method");
+                return;
+            }
+            XMLStreamReader xmlReader = message.getContent(XMLStreamReader.class);
+            try {
+                int i = xmlReader.getEventType();
+                while (i == XMLStreamReader.NAMESPACE
+                    || i == XMLStreamReader.ATTRIBUTE
+                    || i == XMLStreamReader.CHARACTERS) {
+                    i = xmlReader.next();
+                }
+            } catch (XMLStreamException e) {
+                throw new SoapFault(new Message("XML_STREAM_EXC", LOG, e.getMessage()), e, 
+                                    message.getVersion().getSender());
+            }
+
+        }
+
+    }
+
 
     private class TokenStoreCallbackHandler implements CallbackHandler {
         private CallbackHandler internal;

http://git-wip-us.apache.org/repos/asf/cxf/blob/7554fa13/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/SignatureWhitespaceTest.java
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/SignatureWhitespaceTest.java b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/SignatureWhitespaceTest.java
index 2f3cc43..bf768f4 100644
--- a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/SignatureWhitespaceTest.java
+++ b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/SignatureWhitespaceTest.java
@@ -31,9 +31,13 @@ import javax.xml.ws.Service;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.endpoint.Client;
+import org.apache.cxf.jaxws.DispatchImpl;
 import org.apache.cxf.systest.ws.common.SecurityTestUtil;
 import org.apache.cxf.systest.ws.common.TestParam;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.apache.cxf.transport.http.HTTPConduit;
+import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
 import org.example.contract.doubleit.DoubleItPortType;
 import org.junit.BeforeClass;
 import org.junit.runner.RunWith;
@@ -49,6 +53,12 @@ public class SignatureWhitespaceTest extends AbstractBusClientServerTestBase {
 
     private static final String NAMESPACE = "http://www.example.org/contract/DoubleIt";
     private static final QName SERVICE_QNAME = new QName(NAMESPACE, "DoubleItService");
+
+    final TestParam test;
+
+    public SignatureWhitespaceTest(TestParam type) {
+        this.test = type;
+    }
     
     @BeforeClass
     public static void startServers() throws Exception {
@@ -66,12 +76,6 @@ public class SignatureWhitespaceTest extends AbstractBusClientServerTestBase {
         );
     }
     
-    final TestParam test;
-    
-    public SignatureWhitespaceTest(TestParam type) {
-        this.test = type;
-    }
-    
     @org.junit.AfterClass
     public static void cleanup() throws Exception {
         SecurityTestUtil.cleanup();
@@ -111,10 +115,7 @@ public class SignatureWhitespaceTest extends AbstractBusClientServerTestBase {
     
     @org.junit.Test
     public void testTrailingWhitespaceInSOAPBody() throws Exception {
-        // TODO Bug
-        if (STAX_PORT.equals(test.getPort())) {
-            return;
-        }
+
         SpringBusFactory bf = new SpringBusFactory();
         URL busFile = SignatureWhitespaceTest.class.getResource("client.xml");
 
@@ -129,6 +130,16 @@ public class SignatureWhitespaceTest extends AbstractBusClientServerTestBase {
         Dispatch<StreamSource> dispatch = 
             service.createDispatch(portQName, StreamSource.class, Service.Mode.MESSAGE);
         
+        Client client = ((DispatchImpl<StreamSource>) dispatch).getClient();
+
+        HTTPConduit http = (HTTPConduit) client.getConduit();
+
+        HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
+        httpClientPolicy.setConnectionTimeout(0);
+        httpClientPolicy.setReceiveTimeout(0);
+        http.setClient(httpClientPolicy);
+
+        
         // Creating a DOMSource Object for the request
         
         URL requestFile = 
@@ -145,10 +156,7 @@ public class SignatureWhitespaceTest extends AbstractBusClientServerTestBase {
     
     @org.junit.Test
     public void testAddedCommentsInSOAPBody() throws Exception {
-        // TODO Bug
-        if (STAX_PORT.equals(test.getPort())) {
-            return;
-        }
+
         SpringBusFactory bf = new SpringBusFactory();
         URL busFile = SignatureWhitespaceTest.class.getResource("client.xml");
 
@@ -176,4 +184,5 @@ public class SignatureWhitespaceTest extends AbstractBusClientServerTestBase {
         StreamSource response = dispatch.invoke(request);
         assertNotNull(response);
     }
+    
 }


[2/4] cxf git commit: Adding @Ignore'd tests for WSS4J Stax whitespace issue

Posted by co...@apache.org.
Adding @Ignore'd tests for WSS4J Stax whitespace issue


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

Branch: refs/heads/3.0.x-fixes
Commit: 2f89d0013c63de069fa9fffcde959fa8b141d81d
Parents: d9a8678
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Fri Jan 20 12:06:20 2017 +0000
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Fri Jan 20 16:22:27 2017 +0000

----------------------------------------------------------------------
 .../systest/ws/action/SignatureStaxServer.java  | 41 ++++++++++
 .../ws/action/SignatureWhitespaceTest.java      | 41 +++++++++-
 .../cxf/systest/ws/action/signature-server.xml  | 12 +--
 .../systest/ws/action/signature-stax-server.xml | 81 ++++++++++++++++++++
 4 files changed, 166 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/2f89d001/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/SignatureStaxServer.java
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/SignatureStaxServer.java b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/SignatureStaxServer.java
new file mode 100644
index 0000000..fdee170
--- /dev/null
+++ b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/SignatureStaxServer.java
@@ -0,0 +1,41 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.ws.action;
+
+import java.net.URL;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+
+public class SignatureStaxServer extends AbstractBusTestServerBase {
+
+    public SignatureStaxServer() {
+
+    }
+
+    protected void run()  {
+        URL busFile = SignatureStaxServer.class.getResource("signature-stax-server.xml");
+        Bus busLocal = new SpringBusFactory().createBus(busFile);
+        BusFactory.setDefaultBus(busLocal);
+        setBus(busLocal);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/2f89d001/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/SignatureWhitespaceTest.java
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/SignatureWhitespaceTest.java b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/SignatureWhitespaceTest.java
index f4de930..2f3cc43 100644
--- a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/SignatureWhitespaceTest.java
+++ b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/SignatureWhitespaceTest.java
@@ -21,6 +21,8 @@ package org.apache.cxf.systest.ws.action;
 
 import java.io.File;
 import java.net.URL;
+import java.util.Arrays;
+import java.util.Collection;
 
 import javax.xml.namespace.QName;
 import javax.xml.transform.stream.StreamSource;
@@ -30,15 +32,20 @@ import javax.xml.ws.Service;
 import org.apache.cxf.Bus;
 import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.apache.cxf.systest.ws.common.SecurityTestUtil;
+import org.apache.cxf.systest.ws.common.TestParam;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.example.contract.doubleit.DoubleItPortType;
 import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized.Parameters;
 
 /**
  * A test for CXF-5679.
  */
+@RunWith(value = org.junit.runners.Parameterized.class)
 public class SignatureWhitespaceTest extends AbstractBusClientServerTestBase {
     public static final String PORT = allocatePort(SignatureServer.class);
+    public static final String STAX_PORT = allocatePort(SignatureStaxServer.class);
 
     private static final String NAMESPACE = "http://www.example.org/contract/DoubleIt";
     private static final QName SERVICE_QNAME = new QName(NAMESPACE, "DoubleItService");
@@ -51,6 +58,18 @@ public class SignatureWhitespaceTest extends AbstractBusClientServerTestBase {
                 // set this to false to fork
                 launchServer(SignatureServer.class, true)
         );
+        assertTrue(
+                   "Server failed to launch",
+                   // run the server in the same process
+                   // set this to false to fork
+                   launchServer(SignatureStaxServer.class, true)
+        );
+    }
+    
+    final TestParam test;
+    
+    public SignatureWhitespaceTest(TestParam type) {
+        this.test = type;
     }
     
     @org.junit.AfterClass
@@ -58,6 +77,14 @@ public class SignatureWhitespaceTest extends AbstractBusClientServerTestBase {
         SecurityTestUtil.cleanup();
         stopAllServers();
     }
+    
+    @Parameters(name = "{0}")
+    public static Collection<TestParam[]> data() {
+       
+        return Arrays.asList(new TestParam[][] {{new TestParam(PORT, false)},
+                                                {new TestParam(STAX_PORT, false)},
+        });
+    }
 
     @org.junit.Test
     public void testNormalSignedSOAPBody() throws Exception {
@@ -74,7 +101,7 @@ public class SignatureWhitespaceTest extends AbstractBusClientServerTestBase {
         QName portQName = new QName(NAMESPACE, "DoubleItSignaturePort");
         DoubleItPortType port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
+        updateAddressPort(port, test.getPort());
         
         port.doubleIt(25);
         
@@ -84,6 +111,10 @@ public class SignatureWhitespaceTest extends AbstractBusClientServerTestBase {
     
     @org.junit.Test
     public void testTrailingWhitespaceInSOAPBody() throws Exception {
+        // TODO Bug
+        if (STAX_PORT.equals(test.getPort())) {
+            return;
+        }
         SpringBusFactory bf = new SpringBusFactory();
         URL busFile = SignatureWhitespaceTest.class.getResource("client.xml");
 
@@ -105,7 +136,7 @@ public class SignatureWhitespaceTest extends AbstractBusClientServerTestBase {
         
         StreamSource request = new StreamSource(new File(requestFile.getPath()));
 
-        updateAddressPort(dispatch, PORT);
+        updateAddressPort(dispatch, test.getPort());
         
         // Make a successful request
         StreamSource response = dispatch.invoke(request);
@@ -114,6 +145,10 @@ public class SignatureWhitespaceTest extends AbstractBusClientServerTestBase {
     
     @org.junit.Test
     public void testAddedCommentsInSOAPBody() throws Exception {
+        // TODO Bug
+        if (STAX_PORT.equals(test.getPort())) {
+            return;
+        }
         SpringBusFactory bf = new SpringBusFactory();
         URL busFile = SignatureWhitespaceTest.class.getResource("client.xml");
 
@@ -135,7 +170,7 @@ public class SignatureWhitespaceTest extends AbstractBusClientServerTestBase {
         
         StreamSource request = new StreamSource(new File(requestFile.getPath()));
 
-        updateAddressPort(dispatch, PORT);
+        updateAddressPort(dispatch, test.getPort());
         
         // Make a successful request
         StreamSource response = dispatch.invoke(request);

http://git-wip-us.apache.org/repos/asf/cxf/blob/2f89d001/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/signature-server.xml
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/signature-server.xml b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/signature-server.xml
index 4ba1e50..ab71349 100644
--- a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/signature-server.xml
+++ b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/signature-server.xml
@@ -26,9 +26,9 @@
         </cxf:features>
     </cxf:bus>
     
-    <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt" id="Signature" address="http://localhost:${testutil.ports.SignatureServer}/DoubleItSignature" serviceName="s:DoubleItService" endpointName="s:DoubleItSignaturePort" implementor="org.apache.cxf.systest.ws.common.DoubleItImpl" wsdlLocation="org/apache/cxf/systest/ws/action/DoubleItAction.wsdl">
+    <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt" id="Signature" address="http://localhost:${testutil.ports.SignatureStaxServer}/DoubleItSignature" serviceName="s:DoubleItService" endpointName="s:DoubleItSignaturePort" implementor="org.apache.cxf.systest.ws.common.DoubleItImpl" wsdlLocation="org/apache/cxf/systest/ws/action/DoubleItAction.wsdl">
         <jaxws:outInterceptors>
-            <bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
+            <bean class="org.apache.cxf.ws.security.wss4j.WSS4JStaxOutInterceptor">
                 <constructor-arg>
                     <map>
                         <entry key="action" value="Signature"/>
@@ -41,7 +41,7 @@
             </bean>
         </jaxws:outInterceptors>
         <jaxws:inInterceptors>
-            <bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
+            <bean class="org.apache.cxf.ws.security.wss4j.WSS4JStaxInInterceptor">
                 <constructor-arg>
                     <map>
                         <entry key="action" value="Signature"/>
@@ -52,9 +52,9 @@
         </jaxws:inInterceptors>
     </jaxws:endpoint>
     
-    <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt" id="Signature2" address="http://localhost:${testutil.ports.SignatureServer}/DoubleItSignature2" serviceName="s:DoubleItService" endpointName="s:DoubleItSignaturePort2" implementor="org.apache.cxf.systest.ws.common.DoubleItImpl" wsdlLocation="org/apache/cxf/systest/ws/action/DoubleItAction.wsdl">
+    <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt" id="Signature2" address="http://localhost:${testutil.ports.SignatureStaxServer}/DoubleItSignature2" serviceName="s:DoubleItService" endpointName="s:DoubleItSignaturePort2" implementor="org.apache.cxf.systest.ws.common.DoubleItImpl" wsdlLocation="org/apache/cxf/systest/ws/action/DoubleItAction.wsdl">
         <jaxws:outInterceptors>
-            <bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
+            <bean class="org.apache.cxf.ws.security.wss4j.WSS4JStaxOutInterceptor">
                 <constructor-arg>
                     <map>
                         <entry key="action" value="Signature"/>
@@ -67,7 +67,7 @@
             </bean>
         </jaxws:outInterceptors>
         <jaxws:inInterceptors>
-            <bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
+            <bean class="org.apache.cxf.ws.security.wss4j.WSS4JStaxInInterceptor">
                 <constructor-arg>
                     <map>
                         <entry key="action" value="Signature"/>

http://git-wip-us.apache.org/repos/asf/cxf/blob/2f89d001/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/signature-stax-server.xml
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/signature-stax-server.xml b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/signature-stax-server.xml
new file mode 100644
index 0000000..5327944
--- /dev/null
+++ b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/signature-stax-server.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+ 
+ http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:http="http://cxf.apache.org/transports/http/configuration" xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration" xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:cxf="http://cxf.apache.org/core" xmlns:p="http://cxf.apache.org/policy" xsi:schemaLocation="         http://www.springframework.org/schema/beans                     http://www.springframework.org/schema/beans/spring-beans-4.2.xsd         http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.2.xsd         http://cxf.apache.org/jaxws                                     http://cxf.apache.org/schemas/jaxws.xsd         http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd         http://cxf.apache.org/policy http://cxf.apache.o
 rg/schemas/policy.xsd         http://cxf.apache.org/transports/http/configuration             http://cxf.apache.org/schemas/configuration/http-conf.xsd         http://cxf.apache.org/transports/http-jetty/configuration       http://cxf.apache.org/schemas/configuration/http-jetty.xsd         http://cxf.apache.org/configuration/security                    http://cxf.apache.org/schemas/configuration/security.xsd     ">
+    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+    <cxf:bus>
+        <cxf:features>
+            <p:policies/>
+            <cxf:logging/>
+        </cxf:features>
+    </cxf:bus>
+    
+    <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt" id="Signature" address="http://localhost:${testutil.ports.SignatureServer}/DoubleItSignature" serviceName="s:DoubleItService" endpointName="s:DoubleItSignaturePort" implementor="org.apache.cxf.systest.ws.common.DoubleItImpl" wsdlLocation="org/apache/cxf/systest/ws/action/DoubleItAction.wsdl">
+        <jaxws:outInterceptors>
+            <bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
+                <constructor-arg>
+                    <map>
+                        <entry key="action" value="Signature"/>
+                        <entry key="signatureUser" value="bob"/>
+                        <entry key="signaturePropFile" value="bob.properties"/>
+                        <entry key="signatureKeyIdentifier" value="DirectReference"/>
+                        <entry key="passwordCallbackClass" value="org.apache.cxf.systest.ws.common.KeystorePasswordCallback"/>
+                    </map>
+                </constructor-arg>
+            </bean>
+        </jaxws:outInterceptors>
+        <jaxws:inInterceptors>
+            <bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
+                <constructor-arg>
+                    <map>
+                        <entry key="action" value="Signature"/>
+                        <entry key="signatureVerificationPropFile" value="bob.properties"/>
+                    </map>
+                </constructor-arg>
+            </bean>
+        </jaxws:inInterceptors>
+    </jaxws:endpoint>
+    
+    <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt" id="Signature2" address="http://localhost:${testutil.ports.SignatureServer}/DoubleItSignature2" serviceName="s:DoubleItService" endpointName="s:DoubleItSignaturePort2" implementor="org.apache.cxf.systest.ws.common.DoubleItImpl" wsdlLocation="org/apache/cxf/systest/ws/action/DoubleItAction.wsdl">
+        <jaxws:outInterceptors>
+            <bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
+                <constructor-arg>
+                    <map>
+                        <entry key="action" value="Signature"/>
+                        <entry key="signatureUser" value="bob"/>
+                        <entry key="signaturePropFile" value="bob.properties"/>
+                        <entry key="signatureKeyIdentifier" value="DirectReference"/>
+                        <entry key="passwordCallbackClass" value="org.apache.cxf.systest.ws.common.KeystorePasswordCallback"/>
+                    </map>
+                </constructor-arg>
+            </bean>
+        </jaxws:outInterceptors>
+        <jaxws:inInterceptors>
+            <bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
+                <constructor-arg>
+                    <map>
+                        <entry key="action" value="Signature"/>
+                        <entry key="signatureVerificationPropFile" 
+                               value="org/apache/cxf/systest/ws/action/bob-modified.properties"/>
+                    </map>
+                </constructor-arg>
+            </bean>
+        </jaxws:inInterceptors>
+    </jaxws:endpoint>
+</beans>