Author: coheigea
Date: Mon Oct 8 13:23:35 2012
New Revision: 1395548
URL: http://svn.apache.org/viewvc?rev=1395548&view=rev
Log:
Added a ContentEncryptedElements policy system test
Modified:
cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/X509TokenTest.java
cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/DoubleItX509.wsdl
cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/client/client.xml
cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/server/server.xml
Modified:
cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/X509TokenTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/X509TokenTest.java?rev=1395548&r1=1395547&r2=1395548&view=diff
==============================================================================
---
cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/X509TokenTest.java
(original)
+++
cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/X509TokenTest.java
Mon Oct 8 13:23:35 2012
@@ -205,6 +205,30 @@ public class X509TokenTest extends Abstr
}
@org.junit.Test
+ public void testContentEncryptedElements() throws Exception {
+ if (!unrestrictedPoliciesInstalled) {
+ return;
+ }
+
+ SpringBusFactory bf = new SpringBusFactory();
+ URL busFile = X509TokenTest.class.getResource("client/client.xml");
+
+ Bus bus = bf.createBus(busFile.toString());
+ SpringBusFactory.setDefaultBus(bus);
+ SpringBusFactory.setThreadDefaultBus(bus);
+
+ URL wsdl = X509TokenTest.class.getResource("DoubleItX509.wsdl");
+ Service service = Service.create(wsdl, SERVICE_QNAME);
+ QName portQName = new QName(NAMESPACE,
"DoubleItContentEncryptedElementsPort");
+ DoubleItPortType x509Port =
+ service.getPort(portQName, DoubleItPortType.class);
+ updateAddressPort(x509Port, PORT);
+ x509Port.doubleIt(25);
+
+ bus.shutdown(true);
+ }
+
+ @org.junit.Test
public void testAsymmetricIssuerSerial() throws Exception {
if (!unrestrictedPoliciesInstalled) {
return;
Modified:
cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/DoubleItX509.wsdl
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/DoubleItX509.wsdl?rev=1395548&r1=1395547&r2=1395548&view=diff
==============================================================================
---
cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/DoubleItX509.wsdl
(original)
+++
cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/DoubleItX509.wsdl
Mon Oct 8 13:23:35 2012
@@ -87,6 +87,25 @@
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
+ <wsdl:binding name="DoubleItContentEncryptedElementsBinding"
type="tns:DoubleItPortType">
+ <wsp:PolicyReference URI="#DoubleItThumbprintPolicy" />
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="DoubleIt">
+ <soap:operation soapAction="" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ <wsp:PolicyReference
URI="#DoubleItBinding_DoubleIt_Content_Encrypted_Input_Policy"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ <wsp:PolicyReference
URI="#DoubleItBinding_DoubleIt_Content_Encrypted_Output_Policy"/>
+ </wsdl:output>
+ <wsdl:fault name="DoubleItFault">
+ <soap:body use="literal" name="DoubleItFault" />
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
<wsdl:binding name="DoubleItAsymmetricIssuerSerialBinding"
type="tns:DoubleItPortType">
<wsp:PolicyReference URI="#DoubleItAsymmetricIssuerSerialPolicy" />
<soap:binding style="document"
@@ -303,6 +322,10 @@
<wsdl:port name="DoubleItThumbprintPort"
binding="tns:DoubleItThumbprintBinding">
<soap:address
location="http://localhost:9001/DoubleItX509Thumbprint" />
</wsdl:port>
+ <wsdl:port name="DoubleItContentEncryptedElementsPort"
+ binding="tns:DoubleItContentEncryptedElementsBinding">
+ <soap:address
location="http://localhost:9001/DoubleItX509ContentEncryptedElements" />
+ </wsdl:port>
<wsdl:port name="DoubleItAsymmetricIssuerSerialPort"
binding="tns:DoubleItAsymmetricIssuerSerialBinding">
<soap:address
location="http://localhost:9001/DoubleItX509Asymmetric" />
@@ -924,6 +947,18 @@
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
+ <wsp:Policy
wsu:Id="DoubleItBinding_DoubleIt_Content_Encrypted_Input_Policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:ContentEncryptedElements>
+ <sp:XPath>//*[local-name()='Body']</sp:XPath>
+ </sp:ContentEncryptedElements>
+ <sp:SignedParts>
+ <sp:Body/>
+ </sp:SignedParts>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
<wsp:Policy wsu:Id="DoubleItBinding_DoubleIt_Output_Policy">
<wsp:ExactlyOne>
<wsp:All>
@@ -936,5 +971,17 @@
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
+ <wsp:Policy
wsu:Id="DoubleItBinding_DoubleIt_Content_Encrypted_Output_Policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:ContentEncryptedElements>
+ <sp:XPath>//*[local-name()='Body']</sp:XPath>
+ </sp:ContentEncryptedElements>
+ <sp:SignedParts>
+ <sp:Body/>
+ </sp:SignedParts>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
</wsdl:definitions>
Modified:
cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/client/client.xml
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/client/client.xml?rev=1395548&r1=1395547&r2=1395548&view=diff
==============================================================================
---
cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/client/client.xml
(original)
+++
cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/client/client.xml
Mon Oct 8 13:23:35 2012
@@ -66,6 +66,15 @@
</jaxws:properties>
</jaxws:client>
+ <jaxws:client
name="{http://www.example.org/contract/DoubleIt}DoubleItContentEncryptedElementsPort"
+ createdFromAPI="true">
+ <jaxws:properties>
+ <entry key="ws-security.encryption.properties"
+
value="org/apache/cxf/systest/ws/wssec10/client/bob.properties"/>
+ <entry key="ws-security.encryption.username" value="bob"/>
+ </jaxws:properties>
+ </jaxws:client>
+
<jaxws:client
name="{http://www.example.org/contract/DoubleIt}DoubleItAsymmetricIssuerSerialPort"
createdFromAPI="true">
<jaxws:properties>
Modified:
cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/server/server.xml
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/server/server.xml?rev=1395548&r1=1395547&r2=1395548&view=diff
==============================================================================
---
cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/server/server.xml
(original)
+++
cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/server/server.xml
Mon Oct 8 13:23:35 2012
@@ -121,6 +121,24 @@
</jaxws:endpoint>
<jaxws:endpoint
+ id="ContentEncryptedElements"
+
address="http://localhost:${testutil.ports.Server}/DoubleItX509ContentEncryptedElements"
+ serviceName="s:DoubleItService"
+ endpointName="s:DoubleItContentEncryptedElementsPort"
+ xmlns:s="http://www.example.org/contract/DoubleIt"
+ implementor="org.apache.cxf.systest.ws.common.DoubleItImpl"
+ wsdlLocation="org/apache/cxf/systest/ws/x509/DoubleItX509.wsdl">
+
+ <jaxws:properties>
+ <entry key="ws-security.callback-handler"
+
value="org.apache.cxf.systest.ws.wssec10.client.KeystorePasswordCallback"/>
+ <entry key="ws-security.signature.properties"
+
value="org/apache/cxf/systest/ws/wssec10/client/bob.properties"/>
+ </jaxws:properties>
+
+ </jaxws:endpoint>
+
+ <jaxws:endpoint
id="Asymmetric"
address="http://localhost:${testutil.ports.Server}/DoubleItX509Asymmetric"
serviceName="s:DoubleItService"