Author: thilinamb
Date: Tue Mar  1 06:45:01 2011
New Revision: 1075676

URL: http://svn.apache.org/viewvc?rev=1075676&view=rev
Log:
Adding a test case to validate ContentEncryptedElements support.

Added:
    
axis/axis2/java/rampart/trunk/modules/rampart-integration/src/test/resources/rampart/policy/32.xml
    
axis/axis2/java/rampart/trunk/modules/rampart-integration/src/test/resources/rampart/services-32.xml
Modified:
    axis/axis2/java/rampart/trunk/modules/rampart-integration/pom.xml
    
axis/axis2/java/rampart/trunk/modules/rampart-integration/src/test/java/org/apache/rampart/RampartTest.java

Modified: axis/axis2/java/rampart/trunk/modules/rampart-integration/pom.xml
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/rampart/trunk/modules/rampart-integration/pom.xml?rev=1075676&r1=1075675&r2=1075676&view=diff
==============================================================================
--- axis/axis2/java/rampart/trunk/modules/rampart-integration/pom.xml (original)
+++ axis/axis2/java/rampart/trunk/modules/rampart-integration/pom.xml Tue Mar  
1 06:45:01 2011
@@ -253,6 +253,10 @@
                                 <copy overwrite="yes" 
file="src/test/resources/rampart/services-31.xml" 
tofile="target/temp-ramp/META-INF/services.xml" />
                                 <jar 
jarfile="target/test-resources/rampart_service_repo/services/SecureService31.aar"
 basedir="target/temp-ramp" />
 
+                                <!-- Service 32 -->
+                                <copy overwrite="yes" 
file="src/test/resources/rampart/services-32.xml" 
tofile="target/temp-ramp/META-INF/services.xml" />
+                                <jar 
jarfile="target/test-resources/rampart_service_repo/services/SecureService32.aar"
 basedir="target/temp-ramp" />
+
                                 <!-- Service SC-1 -->
                                 <copy overwrite="yes" 
file="src/test/resources/rampart/issuer.properties" 
tofile="target/temp-ramp/issuer.properties" />
                                 <copy overwrite="yes" 
file="src/test/resources/rampart/services-sc-1.xml" 
tofile="target/temp-ramp/META-INF/services.xml" />

Modified: 
axis/axis2/java/rampart/trunk/modules/rampart-integration/src/test/java/org/apache/rampart/RampartTest.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/rampart/trunk/modules/rampart-integration/src/test/java/org/apache/rampart/RampartTest.java?rev=1075676&r1=1075675&r2=1075676&view=diff
==============================================================================
--- 
axis/axis2/java/rampart/trunk/modules/rampart-integration/src/test/java/org/apache/rampart/RampartTest.java
 (original)
+++ 
axis/axis2/java/rampart/trunk/modules/rampart-integration/src/test/java/org/apache/rampart/RampartTest.java
 Tue Mar  1 06:45:01 2011
@@ -16,6 +16,7 @@
 
 package org.apache.rampart;
 
+import junit.framework.TestCase;
 import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMFactory;
@@ -23,21 +24,17 @@ import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
 import org.apache.axiom.om.util.AXIOMUtil;
 import org.apache.axiom.soap.SOAPHeaderBlock;
-import org.apache.axis2.Constants;
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.Options;
 import org.apache.axis2.client.ServiceClient;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.integration.UtilServer;
 import org.apache.neethi.Policy;
 import org.apache.neethi.PolicyEngine;
-import org.apache.ws.security.handler.WSHandlerConstants;
-
-import junit.framework.TestCase;
 
 
 public class RampartTest extends TestCase {
@@ -86,7 +83,7 @@ public class RampartTest extends TestCas
                         "Unlimited Strength Jurisdiction Policy !!!");
             }
             
-            for (int i = 1; i <= 31; i++) { //<-The number of tests we have
+            for (int i = 1; i <= 32; i++) { //<-The number of tests we have
                 if(!basic256Supported && (i == 3 || i == 4 || i == 5)) {
                     //Skip the Basic256 tests
                     continue;

Added: 
axis/axis2/java/rampart/trunk/modules/rampart-integration/src/test/resources/rampart/policy/32.xml
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/rampart/trunk/modules/rampart-integration/src/test/resources/rampart/policy/32.xml?rev=1075676&view=auto
==============================================================================
--- 
axis/axis2/java/rampart/trunk/modules/rampart-integration/src/test/resources/rampart/policy/32.xml
 (added)
+++ 
axis/axis2/java/rampart/trunk/modules/rampart-integration/src/test/resources/rampart/policy/32.xml
 Tue Mar  1 06:45:01 2011
@@ -0,0 +1,90 @@
+<wsp:Policy wsu:Id="EncrSigHeader"
+            
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
+            xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy";>
+    <wsp:ExactlyOne>
+        <wsp:All>
+            <sp:AsymmetricBinding
+                    
xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702";>
+                <wsp:Policy>
+                    <sp:InitiatorToken>
+                        <wsp:Policy>
+                            <sp:X509Token
+                                    
sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient";>
+                                <wsp:Policy>
+                                    <sp:WssX509V3Token10/>
+                                </wsp:Policy>
+                            </sp:X509Token>
+                        </wsp:Policy>
+                    </sp:InitiatorToken>
+                    <sp:RecipientToken>
+                        <wsp:Policy>
+                            <sp:X509Token
+                                    
sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Never";>
+                                <wsp:Policy>
+                                    <sp:WssX509V3Token10/>
+                                </wsp:Policy>
+                            </sp:X509Token>
+                        </wsp:Policy>
+                    </sp:RecipientToken>
+                    <sp:AlgorithmSuite>
+                        <wsp:Policy>
+                            <sp:Basic128/>
+                        </wsp:Policy>
+                    </sp:AlgorithmSuite>
+                    <sp:Layout>
+                        <wsp:Policy>
+                            <sp:Strict/>
+                        </wsp:Policy>
+                    </sp:Layout>
+                    <sp:IncludeTimestamp/>
+                    <sp:EncryptBeforeSigning/>
+                    <sp:OnlySignEntireHeadersAndBody/>
+                </wsp:Policy>
+            </sp:AsymmetricBinding>
+            <sp:Wss10 
xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702";>
+                <wsp:Policy>
+                    <sp:MustSupportRefKeyIdentifier/>
+                    <sp:MustSupportRefIssuerSerial/>
+                </wsp:Policy>
+            </sp:Wss10>
+            <sp:ContentEncryptedElements
+                    
xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702";
+                    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
+                    xmlns:example1="http://example1.org/example1";>
+                <sp:XPath>soapenv:Body/example1:echo/example1:Text</sp:XPath>
+            </sp:ContentEncryptedElements>
+            <ramp:RampartConfig 
xmlns:ramp="http://ws.apache.org/rampart/policy";>
+                <ramp:user>alice</ramp:user>
+                <ramp:encryptionUser>bob</ramp:encryptionUser>
+                <ramp:passwordCallbackClass>org.apache.rampart.PWCallback
+                </ramp:passwordCallbackClass>
+                <ramp:signatureCrypto>
+                    <ramp:crypto 
provider="org.apache.ws.security.components.crypto.Merlin">
+                        <ramp:property 
name="org.apache.ws.security.crypto.merlin.keystore.type">JKS
+                        </ramp:property>
+                        <ramp:property 
name="org.apache.ws.security.crypto.merlin.file">
+                            rampart/store.jks
+                        </ramp:property>
+                        <ramp:property
+                                
name="org.apache.ws.security.crypto.merlin.keystore.password">
+                            password
+                        </ramp:property>
+                    </ramp:crypto>
+                </ramp:signatureCrypto>
+                <ramp:encryptionCypto>
+                    <ramp:crypto 
provider="org.apache.ws.security.components.crypto.Merlin">
+                        <ramp:property 
name="org.apache.ws.security.crypto.merlin.keystore.type">JKS
+                        </ramp:property>
+                        <ramp:property 
name="org.apache.ws.security.crypto.merlin.file">
+                            rampart/store.jks
+                        </ramp:property>
+                        <ramp:property
+                                
name="org.apache.ws.security.crypto.merlin.keystore.password">
+                            password
+                        </ramp:property>
+                    </ramp:crypto>
+                </ramp:encryptionCypto>
+            </ramp:RampartConfig>
+        </wsp:All>
+    </wsp:ExactlyOne>
+</wsp:Policy>

Added: 
axis/axis2/java/rampart/trunk/modules/rampart-integration/src/test/resources/rampart/services-32.xml
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/rampart/trunk/modules/rampart-integration/src/test/resources/rampart/services-32.xml?rev=1075676&view=auto
==============================================================================
--- 
axis/axis2/java/rampart/trunk/modules/rampart-integration/src/test/resources/rampart/services-32.xml
 (added)
+++ 
axis/axis2/java/rampart/trunk/modules/rampart-integration/src/test/resources/rampart/services-32.xml
 Tue Mar  1 06:45:01 2011
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ !
+ ! Copyright 2006 The Apache Software Foundation.
+ !
+ ! Licensed 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.
+ !-->
+<service name="SecureService32">
+
+    <module ref="addressing"/>
+    <module ref="rampart"/>
+
+    <parameter locked="false" 
name="ServiceClass">org.apache.rampart.Service</parameter>
+
+    <operation name="echo">
+        <messageReceiver 
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+        <actionMapping>urn:echo</actionMapping>
+    </operation>
+
+    <operation name="returnError">
+        <messageReceiver 
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+        <actionMapping>urn:returnError</actionMapping>
+    </operation>
+
+    <wsp:Policy wsu:Id="EncrSigHeader"
+                
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
+                xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy";>
+        <wsp:ExactlyOne>
+            <wsp:All>
+                <sp:AsymmetricBinding
+                        
xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702";>
+                    <wsp:Policy>
+                        <sp:InitiatorToken>
+                            <wsp:Policy>
+                                <sp:X509Token
+                                        
sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient";>
+                                    <wsp:Policy>
+                                        <sp:WssX509V3Token10/>
+                                    </wsp:Policy>
+                                </sp:X509Token>
+                            </wsp:Policy>
+                        </sp:InitiatorToken>
+                        <sp:RecipientToken>
+                            <wsp:Policy>
+                                <sp:X509Token
+                                        
sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Never";>
+                                    <wsp:Policy>
+                                        <sp:WssX509V3Token10/>
+                                    </wsp:Policy>
+                                </sp:X509Token>
+                            </wsp:Policy>
+                        </sp:RecipientToken>
+                        <sp:AlgorithmSuite>
+                            <wsp:Policy>
+                                <sp:Basic128/>
+                            </wsp:Policy>
+                        </sp:AlgorithmSuite>
+                        <sp:Layout>
+                            <wsp:Policy>
+                                <sp:Strict/>
+                            </wsp:Policy>
+                        </sp:Layout>
+                        <sp:IncludeTimestamp/>
+                        <sp:EncryptBeforeSigning/>
+                        <sp:OnlySignEntireHeadersAndBody/>
+                    </wsp:Policy>
+                </sp:AsymmetricBinding>
+                <sp:Wss10 
xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702";>
+                    <wsp:Policy>
+                        <sp:MustSupportRefKeyIdentifier/>
+                        <sp:MustSupportRefIssuerSerial/>
+                    </wsp:Policy>
+                </sp:Wss10>
+                <sp:ContentEncryptedElements
+                        
xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702";
+                        
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
+                        xmlns:example1="http://example1.org/example1";>
+                    
<sp:XPath>soapenv:Body/example1:echo/example1:Text</sp:XPath>
+                </sp:ContentEncryptedElements>
+                <ramp:RampartConfig 
xmlns:ramp="http://ws.apache.org/rampart/policy";>
+                    <ramp:user>alice</ramp:user>
+                    <ramp:encryptionUser>bob</ramp:encryptionUser>
+                    <ramp:passwordCallbackClass>org.apache.rampart.PWCallback
+                    </ramp:passwordCallbackClass>
+
+                    <ramp:signatureCrypto>
+                        <ramp:crypto 
provider="org.apache.ws.security.components.crypto.Merlin">
+                            <ramp:property
+                                    
name="org.apache.ws.security.crypto.merlin.keystore.type">JKS
+                            </ramp:property>
+                            <ramp:property 
name="org.apache.ws.security.crypto.merlin.file">
+                                rampart/store.jks
+                            </ramp:property>
+                            <ramp:property
+                                    
name="org.apache.ws.security.crypto.merlin.keystore.password">
+                                password
+                            </ramp:property>
+                        </ramp:crypto>
+                    </ramp:signatureCrypto>
+                    <ramp:encryptionCypto>
+                        <ramp:crypto 
provider="org.apache.ws.security.components.crypto.Merlin">
+                            <ramp:property
+                                    
name="org.apache.ws.security.crypto.merlin.keystore.type">JKS
+                            </ramp:property>
+                            <ramp:property 
name="org.apache.ws.security.crypto.merlin.file">
+                                rampart/store.jks
+                            </ramp:property>
+                            <ramp:property
+                                    
name="org.apache.ws.security.crypto.merlin.keystore.password">
+                                password
+                            </ramp:property>
+                        </ramp:crypto>
+                    </ramp:encryptionCypto>
+                </ramp:RampartConfig>
+            </wsp:All>
+        </wsp:ExactlyOne>
+    </wsp:Policy>
+</service>


Reply via email to