Adding SP11 UsernameToken test
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/e0be423d Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/e0be423d Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/e0be423d Branch: refs/heads/3.0.x-fixes Commit: e0be423dc3d682e69578398e2027cd14aa9b6f2e Parents: 133b893 Author: Colm O hEigeartaigh <cohei...@apache.org> Authored: Mon Jan 4 11:59:48 2016 +0000 Committer: Colm O hEigeartaigh <cohei...@apache.org> Committed: Mon Jan 4 12:16:38 2016 +0000 ---------------------------------------------------------------------- .../cxf/systest/ws/ut/UsernameTokenTest.java | 27 ++++++++++++++++ .../apache/cxf/systest/ws/ut/DoubleItUt.wsdl | 34 ++++++++++++++++++++ .../org/apache/cxf/systest/ws/ut/client.xml | 6 ++++ .../org/apache/cxf/systest/ws/ut/server.xml | 5 +++ .../apache/cxf/systest/ws/ut/stax-server.xml | 6 ++++ 5 files changed, 78 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/e0be423d/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/UsernameTokenTest.java ---------------------------------------------------------------------- diff --git a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/UsernameTokenTest.java b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/UsernameTokenTest.java index 4f8d2cd..b9514c2 100644 --- a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/UsernameTokenTest.java +++ b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/UsernameTokenTest.java @@ -172,6 +172,33 @@ public class UsernameTokenTest extends AbstractBusClientServerTestBase { } @org.junit.Test + public void testPlaintextSupportingSP11() throws Exception { + + SpringBusFactory bf = new SpringBusFactory(); + URL busFile = UsernameTokenTest.class.getResource("client.xml"); + + Bus bus = bf.createBus(busFile.toString()); + SpringBusFactory.setDefaultBus(bus); + SpringBusFactory.setThreadDefaultBus(bus); + + URL wsdl = UsernameTokenTest.class.getResource("DoubleItUt.wsdl"); + Service service = Service.create(wsdl, SERVICE_QNAME); + QName portQName = new QName(NAMESPACE, "DoubleItPlaintextSupportingSP11Port"); + DoubleItPortType utPort = + service.getPort(portQName, DoubleItPortType.class); + updateAddressPort(utPort, test.getPort()); + + if (test.isStreaming()) { + SecurityTestUtil.enableStreaming(utPort); + } + + utPort.doubleIt(25); + + ((java.io.Closeable)utPort).close(); + bus.shutdown(true); + } + + @org.junit.Test public void testPasswordHashed() throws Exception { SpringBusFactory bf = new SpringBusFactory(); http://git-wip-us.apache.org/repos/asf/cxf/blob/e0be423d/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/DoubleItUt.wsdl ---------------------------------------------------------------------- diff --git a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/DoubleItUt.wsdl b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/DoubleItUt.wsdl index 0163227..4cc8ce2 100644 --- a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/DoubleItUt.wsdl +++ b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/DoubleItUt.wsdl @@ -71,6 +71,22 @@ </wsdl:fault> </wsdl:operation> </wsdl:binding> + <wsdl:binding name="DoubleItPlaintextSupportingSP11Binding" type="tns:DoubleItPortType"> + <wsp:PolicyReference URI="#DoubleItPlaintextSupportingSP11Policy"/> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> + <wsdl:operation name="DoubleIt"> + <soap:operation soapAction=""/> + <wsdl:input> + <soap:body use="literal"/> + </wsdl:input> + <wsdl:output> + <soap:body use="literal"/> + </wsdl:output> + <wsdl:fault name="DoubleItFault"> + <soap:body use="literal" name="DoubleItFault"/> + </wsdl:fault> + </wsdl:operation> + </wsdl:binding> <wsdl:binding name="DoubleItHashedBinding" type="tns:DoubleItPortType"> <wsp:PolicyReference URI="#DoubleItHashedPolicy"/> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> @@ -201,6 +217,9 @@ <wsdl:port name="DoubleItPlaintextSupportingPort" binding="tns:DoubleItPlaintextSupportingBinding"> <soap:address location="https://localhost:9009/DoubleItUTPlaintextSupporting"/> </wsdl:port> + <wsdl:port name="DoubleItPlaintextSupportingSP11Port" binding="tns:DoubleItPlaintextSupportingSP11Binding"> + <soap:address location="https://localhost:9009/DoubleItUTPlaintextSupportingSP11"/> + </wsdl:port> <wsdl:port name="DoubleItHashedPort" binding="tns:DoubleItHashedBinding"> <soap:address location="https://localhost:9009/DoubleItUTHashed"/> </wsdl:port> @@ -319,6 +338,21 @@ </wsp:All> </wsp:ExactlyOne> </wsp:Policy> + <wsp:Policy wsu:Id="DoubleItPlaintextSupportingSP11Policy"> + <wsp:ExactlyOne> + <wsp:All> + <sp:SupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> + <wsp:Policy> + <sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient"> + <wsp:Policy> + <sp:WssUsernameToken10/> + </wsp:Policy> + </sp:UsernameToken> + </wsp:Policy> + </sp:SupportingTokens> + </wsp:All> + </wsp:ExactlyOne> + </wsp:Policy> <wsp:Policy wsu:Id="DoubleItHashedPolicy"> <wsp:ExactlyOne> <wsp:All> http://git-wip-us.apache.org/repos/asf/cxf/blob/e0be423d/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/client.xml ---------------------------------------------------------------------- diff --git a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/client.xml b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/client.xml index 763c001..3ddcaf6 100644 --- a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/client.xml +++ b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/client.xml @@ -49,6 +49,12 @@ <entry key="ws-security.callback-handler" value="org.apache.cxf.systest.ws.common.UTPasswordCallback"/> </jaxws:properties> </jaxws:client> + <jaxws:client name="{http://www.example.org/contract/DoubleIt}DoubleItPlaintextSupportingSP11Port" createdFromAPI="true"> + <jaxws:properties> + <entry key="security.username" value="Alice"/> + <entry key="security.callback-handler" value="org.apache.cxf.systest.ws.common.UTPasswordCallback"/> + </jaxws:properties> + </jaxws:client> <jaxws:client name="{http://www.example.org/contract/DoubleIt}DoubleItHashedPort" createdFromAPI="true"> <jaxws:properties> <entry key="ws-security.username" value="Alice"/> http://git-wip-us.apache.org/repos/asf/cxf/blob/e0be423d/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/server.xml ---------------------------------------------------------------------- diff --git a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/server.xml b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/server.xml index 385b342..124fa5b 100644 --- a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/server.xml +++ b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/server.xml @@ -57,6 +57,11 @@ <entry key="ws-security.callback-handler" value="org.apache.cxf.systest.ws.common.UTPasswordCallback"/> </jaxws:properties> </jaxws:endpoint> + <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt" id="PlaintextSupportingSP11" address="https://localhost:${testutil.ports.ut.Server}/DoubleItUTPlaintextSupportingSP11" serviceName="s:DoubleItService" endpointName="s:DoubleItPlaintextSupportingSP11Port" implementor="org.apache.cxf.systest.ws.common.DoubleItPortTypeImpl" wsdlLocation="org/apache/cxf/systest/ws/ut/DoubleItUt.wsdl" depends-on="tls-settings"> + <jaxws:properties> + <entry key="security.callback-handler" value="org.apache.cxf.systest.ws.common.UTPasswordCallback"/> + </jaxws:properties> + </jaxws:endpoint> <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt" id="Hashed" address="https://localhost:${testutil.ports.ut.Server}/DoubleItUTHashed" serviceName="s:DoubleItService" endpointName="s:DoubleItHashedPort" implementor="org.apache.cxf.systest.ws.common.DoubleItPortTypeImpl" wsdlLocation="org/apache/cxf/systest/ws/ut/DoubleItUt.wsdl" depends-on="tls-settings"> <jaxws:properties> <entry key="ws-security.callback-handler" value="org.apache.cxf.systest.ws.common.UTPasswordCallback"/> http://git-wip-us.apache.org/repos/asf/cxf/blob/e0be423d/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/stax-server.xml ---------------------------------------------------------------------- diff --git a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/stax-server.xml b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/stax-server.xml index ab1344a..f8bd92e 100644 --- a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/stax-server.xml +++ b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/ut/stax-server.xml @@ -60,6 +60,12 @@ <entry key="ws-security.enable.streaming" value="true"/> </jaxws:properties> </jaxws:endpoint> + <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt" id="PlaintextSupportingSP11" address="https://localhost:${testutil.ports.ut.StaxServer}/DoubleItUTPlaintextSupportingSP11" serviceName="s:DoubleItService" endpointName="s:DoubleItPlaintextSupportingSP11Port" implementor="org.apache.cxf.systest.ws.common.DoubleItPortTypeImpl" wsdlLocation="org/apache/cxf/systest/ws/ut/DoubleItUt.wsdl" depends-on="tls-settings"> + <jaxws:properties> + <entry key="security.callback-handler" value="org.apache.cxf.systest.ws.common.UTPasswordCallback"/> + <entry key="ws-security.enable.streaming" value="true"/> + </jaxws:properties> + </jaxws:endpoint> <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt" id="Hashed" address="https://localhost:${testutil.ports.ut.StaxServer}/DoubleItUTHashed" serviceName="s:DoubleItService" endpointName="s:DoubleItHashedPort" implementor="org.apache.cxf.systest.ws.common.DoubleItPortTypeImpl" wsdlLocation="org/apache/cxf/systest/ws/ut/DoubleItUt.wsdl" depends-on="tls-settings"> <jaxws:properties> <entry key="ws-security.callback-handler" value="org.apache.cxf.systest.ws.common.UTPasswordCallback"/>