You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rampart-dev@ws.apache.org by na...@apache.org on 2009/07/07 13:03:03 UTC

svn commit: r791792 - in /webservices/rampart/trunk/java/modules/rampart-integration: pom.xml src/test/java/org/apache/rampart/RampartTest.java src/test/resources/rampart/policy/23.xml src/test/resources/rampart/services-23.xml

Author: nandana
Date: Tue Jul  7 11:03:03 2009
New Revision: 791792

URL: http://svn.apache.org/viewvc?rev=791792&view=rev
Log:
adding a test case for RAMPART-232

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

Modified: webservices/rampart/trunk/java/modules/rampart-integration/pom.xml
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/java/modules/rampart-integration/pom.xml?rev=791792&r1=791791&r2=791792&view=diff
==============================================================================
--- webservices/rampart/trunk/java/modules/rampart-integration/pom.xml (original)
+++ webservices/rampart/trunk/java/modules/rampart-integration/pom.xml Tue Jul  7 11:03:03 2009
@@ -79,7 +79,7 @@
                         </goals>
                         <configuration>
                             <tasks>
-								<java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
+                                <java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
                                     <arg line="-uri src/main/resources/ping/ping.wsdl -ss -o target/generated-code -p org.apache.axis2.oasis.ping -d xmlbeans -g"/>
                                     <classpath refid="maven.dependency.classpath"/>
                                     <classpath refid="maven.compile.classpath"/>
@@ -98,20 +98,20 @@
                                       tofile="target/generated-code/src/org/apache/axis2/security/InteropScenarioClient.java"
                                       overwrite="yes"/>
 
-				                <copy todir="target/test-classes">
+                                <copy todir="target/test-classes">
                                     <fileset dir="target/generated-code/resources">
                                         <include name="**/*"/>
                                     </fileset>
                                 </copy>
 
-								
-								<javac srcdir="target/generated-code" destdir="target/classes" fork="true">
-                    					<classpath refid="maven.dependency.classpath"/>
-                                    	<classpath refid="maven.compile.classpath"/>
-                                    	<classpath refid="maven.runtime.classpath"/>
-								</javac>
-								
-							</tasks>
+
+                                <javac srcdir="target/generated-code" destdir="target/classes" fork="true">
+                                    <classpath refid="maven.dependency.classpath"/>
+                                    <classpath refid="maven.compile.classpath"/>
+                                    <classpath refid="maven.runtime.classpath"/>
+                                </javac>
+
+                            </tasks>
                         </configuration>
                     </execution>
                     <execution>
@@ -218,78 +218,84 @@
                                       tofile="target/temp-ramp/META-INF/services.xml"/>
                                 <jar jarfile="target/test-resources/rampart_service_repo/services/SecureService10.aar"
                                      basedir="target/temp-ramp"/>
-                               <!-- Service 11 -->
-                               <copy overwrite="yes"
+                                <!-- Service 11 -->
+                                <copy overwrite="yes"
                                       file="src/test/resources/rampart/services-11.xml"
                                       tofile="target/temp-ramp/META-INF/services.xml"/>
                                 <jar jarfile="target/test-resources/rampart_service_repo/services/SecureService11.aar"
                                      basedir="target/temp-ramp"/>
-                               <!-- Service 12 -->
-                               <copy overwrite="yes"
+                                <!-- Service 12 -->
+                                <copy overwrite="yes"
                                       file="src/test/resources/rampart/services-12.xml"
                                       tofile="target/temp-ramp/META-INF/services.xml"/>
                                 <jar jarfile="target/test-resources/rampart_service_repo/services/SecureService12.aar"
                                      basedir="target/temp-ramp"/>
-                               <!-- Service 13 -->
-                               <copy overwrite="yes"
+                                <!-- Service 13 -->
+                                <copy overwrite="yes"
                                       file="src/test/resources/rampart/services-13.xml"
                                       tofile="target/temp-ramp/META-INF/services.xml"/>
                                 <jar jarfile="target/test-resources/rampart_service_repo/services/SecureService13.aar"
                                      basedir="target/temp-ramp"/>
-                               <!-- Service 14 -->
-                               <copy overwrite="yes"
+                                <!-- Service 14 -->
+                                <copy overwrite="yes"
                                       file="src/test/resources/rampart/services-14.xml"
                                       tofile="target/temp-ramp/META-INF/services.xml"/>
                                 <jar jarfile="target/test-resources/rampart_service_repo/services/SecureService14.aar"
                                      basedir="target/temp-ramp"/>
-                               <!-- Service 15 -->
-                               <copy overwrite="yes"
+                                <!-- Service 15 -->
+                                <copy overwrite="yes"
                                       file="src/test/resources/rampart/services-15.xml"
                                       tofile="target/temp-ramp/META-INF/services.xml"/>
                                 <jar jarfile="target/test-resources/rampart_service_repo/services/SecureService15.aar"
                                      basedir="target/temp-ramp"/>
-                               <!-- Service 16 -->
-                               <copy overwrite="yes"
+                                <!-- Service 16 -->
+                                <copy overwrite="yes"
                                       file="src/test/resources/rampart/services-16.xml"
                                       tofile="target/temp-ramp/META-INF/services.xml"/>
                                 <jar jarfile="target/test-resources/rampart_service_repo/services/SecureService16.aar"
                                      basedir="target/temp-ramp"/>
-                               <!-- Service 17 -->
-                               <copy overwrite="yes"
+                                <!-- Service 17 -->
+                                <copy overwrite="yes"
                                       file="src/test/resources/rampart/services-17.xml"
                                       tofile="target/temp-ramp/META-INF/services.xml"/>
                                 <jar jarfile="target/test-resources/rampart_service_repo/services/SecureService17.aar"
-                                     basedir="target/temp-ramp"/>  
-                               <!-- Service 18 -->
-                               <copy overwrite="yes"
+                                     basedir="target/temp-ramp"/>
+                                <!-- Service 18 -->
+                                <copy overwrite="yes"
                                       file="src/test/resources/rampart/services-18.xml"
                                       tofile="target/temp-ramp/META-INF/services.xml"/>
                                 <jar jarfile="target/test-resources/rampart_service_repo/services/SecureService18.aar"
-                                     basedir="target/temp-ramp"/>   
-                               <!-- Service 19 -->
-                               <copy overwrite="yes"
+                                     basedir="target/temp-ramp"/>
+                                <!-- Service 19 -->
+                                <copy overwrite="yes"
                                       file="src/test/resources/rampart/services-19.xml"
                                       tofile="target/temp-ramp/META-INF/services.xml"/>
                                 <jar jarfile="target/test-resources/rampart_service_repo/services/SecureService19.aar"
-                                     basedir="target/temp-ramp"/>  
-                               <!-- Service 20 -->
-                               <copy overwrite="yes"
+                                     basedir="target/temp-ramp"/>
+                                <!-- Service 20 -->
+                                <copy overwrite="yes"
                                       file="src/test/resources/rampart/services-20.xml"
                                       tofile="target/temp-ramp/META-INF/services.xml"/>
                                 <jar jarfile="target/test-resources/rampart_service_repo/services/SecureService20.aar"
-                                     basedir="target/temp-ramp"/>  
-                               <!-- Service 21 -->
-                               <copy overwrite="yes"
+                                     basedir="target/temp-ramp"/>
+                                <!-- Service 21 -->
+                                <copy overwrite="yes"
                                       file="src/test/resources/rampart/services-21.xml"
                                       tofile="target/temp-ramp/META-INF/services.xml"/>
                                 <jar jarfile="target/test-resources/rampart_service_repo/services/SecureService21.aar"
                                      basedir="target/temp-ramp"/>
-                               <!-- Service 22 -->
-                               <copy overwrite="yes"
+                                <!-- Service 22 -->
+                                <copy overwrite="yes"
                                       file="src/test/resources/rampart/services-22.xml"
                                       tofile="target/temp-ramp/META-INF/services.xml"/>
                                 <jar jarfile="target/test-resources/rampart_service_repo/services/SecureService22.aar"
                                      basedir="target/temp-ramp"/>
+                                <!-- Service 23 -->
+                                <copy overwrite="yes"
+                                      file="src/test/resources/rampart/services-23.xml"
+                                      tofile="target/temp-ramp/META-INF/services.xml"/>
+                                <jar jarfile="target/test-resources/rampart_service_repo/services/SecureService23.aar"
+                                     basedir="target/temp-ramp"/>
                                 <!-- Service SC-1 -->
                                 <copy overwrite="yes"
                                       file="src/test/resources/rampart/issuer.properties"
@@ -299,8 +305,8 @@
                                       tofile="target/temp-ramp/META-INF/services.xml"/>
                                 <jar jarfile="target/test-resources/rampart_service_repo/services/SecureServiceSC1.aar"
                                      basedir="target/temp-ramp"/>
-								
-								<!-- Service SC-2 -->
+
+                                <!-- Service SC-2 -->
                                 <copy overwrite="yes"
                                       file="src/test/resources/rampart/issuer.properties"
                                       tofile="target/temp-ramp/issuer.properties"/>
@@ -310,7 +316,7 @@
                                 <jar jarfile="target/test-resources/rampart_service_repo/services/SecureServiceSC2.aar"
                                      basedir="target/temp-ramp"/>
 
-								<!-- Service SC-3 -->
+                                <!-- Service SC-3 -->
                                 <copy overwrite="yes"
                                       file="src/test/resources/rampart/issuer.properties"
                                       tofile="target/temp-ramp/issuer.properties"/>
@@ -319,7 +325,7 @@
                                       tofile="target/temp-ramp/META-INF/services.xml"/>
                                 <jar jarfile="target/test-resources/rampart_service_repo/services/SecureServiceSC3.aar"
                                      basedir="target/temp-ramp"/>
-									 
+
                                 <!--
                                  Set up the infra for rahas tests and the rahas client repo
                                 -->
@@ -395,10 +401,10 @@
                                       tofile="target/test-resources/default_security_client_repo/modules/addressing-${addressing.mar.version}.mar"/>
                                 <copy file="src/test/resources/conf/axis2.xml"
                                       tofile="target/test-resources/default_security_client_repo/conf/axis2.xml"/>
-				<!--
-				RahasSAMLTokenAttributeTest
-				-->
-				<mkdir dir="target/test-resources/rahas_service_repo_5"/>
+                                <!--
+                        RahasSAMLTokenAttributeTest
+                        -->
+                                <mkdir dir="target/test-resources/rahas_service_repo_5"/>
                                 <mkdir dir="target/test-resources/rahas_service_repo_5/conf"/>
                                 <mkdir dir="target/test-resources/rahas_service_repo_5/services"/>
                                 <mkdir dir="target/test-resources/rahas_service_repo_5/modules"/>
@@ -415,7 +421,7 @@
                                 <jar jarfile="target/test-resources/rahas_service_repo_5/services/SecureService.aar"
                                      basedir="target/temp-rahas"/>
 
-				<!--RahasAttributeTest END-->
+                                <!--RahasAttributeTest END-->
                                 <!-- Scenario 1 -->
                                 <mkdir dir="target/test-resources/scenario1_client_repo"/>
                                 <mkdir dir="target/test-resources/scenario1_client_repo/conf"/>
@@ -718,17 +724,17 @@
             <groupId>org.apache.axis2</groupId>
             <artifactId>axis2-transport-http</artifactId>
             <version>${axis2.version}</version>
-        </dependency> 
+        </dependency>
         <dependency>
             <groupId>org.apache.axis2</groupId>
             <artifactId>axis2-transport-tcp</artifactId>
             <version>${axis2.transport.version}</version>
-        </dependency> 
+        </dependency>
         <dependency>
             <groupId>org.apache.axis2</groupId>
             <artifactId>axis2-transport-local</artifactId>
             <version>${axis2.version}</version>
-        </dependency> 
+        </dependency>
         <dependency>
             <groupId>org.apache.axis2</groupId>
             <artifactId>axis2-codegen</artifactId>
@@ -743,7 +749,7 @@
             <groupId>org.apache.axis2</groupId>
             <artifactId>axis2-adb-codegen</artifactId>
             <version>${axis2.version}</version>
-        </dependency> 
+        </dependency>
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
@@ -753,16 +759,16 @@
     </dependencies>
 
     <reporting>
-      <plugins>
-        <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-site-plugin</artifactId>
-        <configuration>
-         <templateDirectory>${basedir}</templateDirectory>
-         <menu ref="parent" />
-        </configuration>
-        </plugin>
-      </plugins>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-site-plugin</artifactId>
+                <configuration>
+                    <templateDirectory>${basedir}</templateDirectory>
+                    <menu ref="parent"/>
+                </configuration>
+            </plugin>
+        </plugins>
     </reporting>
 
 </project>

Modified: webservices/rampart/trunk/java/modules/rampart-integration/src/test/java/org/apache/rampart/RampartTest.java
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/java/modules/rampart-integration/src/test/java/org/apache/rampart/RampartTest.java?rev=791792&r1=791791&r2=791792&view=diff
==============================================================================
--- webservices/rampart/trunk/java/modules/rampart-integration/src/test/java/org/apache/rampart/RampartTest.java (original)
+++ webservices/rampart/trunk/java/modules/rampart-integration/src/test/java/org/apache/rampart/RampartTest.java Tue Jul  7 11:03:03 2009
@@ -74,7 +74,7 @@
                         "Unlimited Strength Jurisdiction Policy !!!");
             }
             
-            for (int i = 1; i <= 22; i++) { //<-The number of tests we have
+            for (int i = 1; i <= 23; i++) { //<-The number of tests we have
                 if(!basic256Supported && (i == 3 || i == 4 || i == 5)) {
                     //Skip the Basic256 tests
                     continue;

Added: webservices/rampart/trunk/java/modules/rampart-integration/src/test/resources/rampart/policy/23.xml
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/java/modules/rampart-integration/src/test/resources/rampart/policy/23.xml?rev=791792&view=auto
==============================================================================
--- webservices/rampart/trunk/java/modules/rampart-integration/src/test/resources/rampart/policy/23.xml (added)
+++ webservices/rampart/trunk/java/modules/rampart-integration/src/test/resources/rampart/policy/23.xml Tue Jul  7 11:03:03 2009
@@ -0,0 +1,64 @@
+<wsp:Policy wsu:Id="EncryptedElements"
+            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"
+            xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
+            xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702">
+    <wsp:ExactlyOne>
+        <wsp:All>
+            <sp:SymmetricBinding>
+                <wsp:Policy>
+                    <sp:ProtectionToken>
+                        <wsp:Policy>
+                            <sp:X509Token
+                                    sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Never">
+                                <wsp:Policy>
+                                    <sp:RequireThumbprintReference/>
+                                    <sp:WssX509V3Token10/>
+                                </wsp:Policy>
+                            </sp:X509Token>
+                        </wsp:Policy>
+                    </sp:ProtectionToken>
+                    <sp:AlgorithmSuite>
+                        <wsp:Policy>
+                            <sp:Basic256/>
+                        </wsp:Policy>
+                    </sp:AlgorithmSuite>
+                    <sp:Layout>
+                        <wsp:Policy>
+                            <sp:Lax/>
+                        </wsp:Policy>
+                    </sp:Layout>
+                    <sp:IncludeTimestamp/>
+                    <sp:OnlySignEntireHeadersAndBody/>
+                </wsp:Policy>
+            </sp:SymmetricBinding>
+            <sp:EncryptedElements>
+                <sp:XPath xmlns:example1="http://example1.org/example1">//example1:Text</sp:XPath>
+            </sp:EncryptedElements>
+            <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: webservices/rampart/trunk/java/modules/rampart-integration/src/test/resources/rampart/services-23.xml
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/java/modules/rampart-integration/src/test/resources/rampart/services-23.xml?rev=791792&view=auto
==============================================================================
--- webservices/rampart/trunk/java/modules/rampart-integration/src/test/resources/rampart/services-23.xml (added)
+++ webservices/rampart/trunk/java/modules/rampart-integration/src/test/resources/rampart/services-23.xml Tue Jul  7 11:03:03 2009
@@ -0,0 +1,77 @@
+<service name="SecureService23">
+
+    <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>
+
+    <wsp:Policy wsu:Id="EncryptedElements"
+                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"
+                xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
+                xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702">
+        <wsp:ExactlyOne>
+            <wsp:All>
+                <sp:SymmetricBinding>
+                    <wsp:Policy>
+                        <sp:ProtectionToken>
+                            <wsp:Policy>
+                                <sp:X509Token
+                                        sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Never">
+                                    <wsp:Policy>
+                                        <sp:RequireThumbprintReference/>
+                                        <sp:WssX509V3Token10/>
+                                    </wsp:Policy>
+                                </sp:X509Token>
+                            </wsp:Policy>
+                        </sp:ProtectionToken>
+                        <sp:AlgorithmSuite>
+                            <wsp:Policy>
+                                <sp:Basic256/>
+                            </wsp:Policy>
+                        </sp:AlgorithmSuite>
+                        <sp:Layout>
+                            <wsp:Policy>
+                                <sp:Lax/>
+                            </wsp:Policy>
+                        </sp:Layout>
+                        <sp:IncludeTimestamp/>
+                        <sp:OnlySignEntireHeadersAndBody/>
+                    </wsp:Policy>
+                </sp:SymmetricBinding>
+                <sp:EncryptedElements>
+                    <sp:XPath xmlns:example1="http://example1.org/example1">//example1:Text</sp:XPath>
+                </sp:EncryptedElements>
+                <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+                    <ramp:user>bob</ramp:user>
+                    <ramp:encryptionUser>alice</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>
\ No newline at end of file