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 15:41:26 UTC
[1/3] cxf git commit: Removing unused config
Repository: cxf
Updated Branches:
refs/heads/master 2f981e098 -> 3f350f155
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/0a034653
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/0a034653
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/0a034653
Branch: refs/heads/master
Commit: 0a034653ff7a0aa9f17ce96546d385701d4c0f45
Parents: 2f981e0
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 11:57:35 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/0a034653/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 8cf07c5..fcade32 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="security.callback-handler" value="org.apache.cxf.systest.ws.common.KeystorePasswordCallback"/>
http://git-wip-us.apache.org/repos/asf/cxf/blob/0a034653/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 722c529..5327944 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>
[3/3] 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/3f350f15
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/3f350f15
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/3f350f15
Branch: refs/heads/master
Commit: 3f350f1559f31526e3fe18eb8e600c74b480fd96
Parents: b680ab1
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 15:41:03 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/3f350f15/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 26376f2..fd52bb6 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
@@ -32,6 +32,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;
@@ -96,6 +98,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;
@@ -403,5 +407,45 @@ 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());
+ }
+
+ }
+
+ }
+
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/3f350f15/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/3] 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/b680ab1f
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/b680ab1f
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/b680ab1f
Branch: refs/heads/master
Commit: b680ab1feb3bcc8339b809550698f46b7212b168
Parents: 0a03465
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 12:06:20 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/b680ab1f/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/b680ab1f/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/b680ab1f/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 5327944..e421492 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/b680ab1f/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>