Author: muthulee Date: Thu Dec 23 05:50:47 2010 New Revision: 1052173 URL: http://svn.apache.org/viewvc?rev=1052173&view=rev Log: Testcase to ensure that RAMPART-278 is fixed.
Added: axis/axis2/java/rampart/trunk/modules/rampart-integration/src/test/resources/rampart/policy/31.xml axis/axis2/java/rampart/trunk/modules/rampart-integration/src/test/resources/rampart/services-31.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=1052173&r1=1052172&r2=1052173&view=diff ============================================================================== --- axis/axis2/java/rampart/trunk/modules/rampart-integration/pom.xml (original) +++ axis/axis2/java/rampart/trunk/modules/rampart-integration/pom.xml Thu Dec 23 05:50:47 2010 @@ -339,6 +339,12 @@ <jar jarfile="target/test-resources/rampart_service_repo/services/SecureService30.aar" basedir="target/temp-ramp"/> + <!-- Service 31 --> + <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 SC-1 --> <copy overwrite="yes" 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=1052173&r1=1052172&r2=1052173&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 Thu Dec 23 05:50:47 2010 @@ -21,6 +21,8 @@ import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; 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.addressing.EndpointReference; @@ -77,7 +79,7 @@ public class RampartTest extends TestCas "Unlimited Strength Jurisdiction Policy !!!"); } - for (int i = 1; i <= 30; i++) { //<-The number of tests we have + for (int i = 1; i <= 31; i++) { //<-The number of tests we have if(!basic256Supported && (i == 3 || i == 4 || i == 5)) { //Skip the Basic256 tests continue; @@ -106,7 +108,16 @@ public class RampartTest extends TestCas context.setProperty(RampartMessageData.KEY_RAMPART_POLICY, loadPolicy("/rampart/policy/" + i + ".xml")); serviceClient.setOptions(options); - + + if (i == 31) { + OMNamespace omNamespace = OMAbstractFactory.getOMFactory().createOMNamespace( + "http://sample.com", "myNs"); + SOAPHeaderBlock header = OMAbstractFactory.getSOAP12Factory() + .createSOAPHeaderBlock("VitalHeader", omNamespace); + header.addChild(AXIOMUtil.stringToOM("<foo>This is a sample Header</foo>")); + serviceClient.addHeader(header); + } + // Invoking the serive in the TestCase-28 should fail. So handling it differently.. if (i == 28) { try { Added: axis/axis2/java/rampart/trunk/modules/rampart-integration/src/test/resources/rampart/policy/31.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/trunk/modules/rampart-integration/src/test/resources/rampart/policy/31.xml?rev=1052173&view=auto ============================================================================== --- axis/axis2/java/rampart/trunk/modules/rampart-integration/src/test/resources/rampart/policy/31.xml (added) +++ axis/axis2/java/rampart/trunk/modules/rampart-integration/src/test/resources/rampart/policy/31.xml Thu Dec 23 05:50:47 2010 @@ -0,0 +1,75 @@ +<wsp:Policy wsu:Id="EncrSig" 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://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> + <wsp:Policy> + <sp:InitiatorToken> + <wsp:Policy> + <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient"> + <wsp:Policy> + <sp:WssX509V3Token10/> + </wsp:Policy> + </sp:X509Token> + </wsp:Policy> + </sp:InitiatorToken> + <sp:RecipientToken> + <wsp:Policy> + <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/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://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> + <wsp:Policy> + <sp:MustSupportRefKeyIdentifier/> + <sp:MustSupportRefIssuerSerial/> + </wsp:Policy> + </sp:Wss10> + <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> + <sp:Body/> + <sp:Header Name="VitalHeader" Namespace="http://sample.com"/> + </sp:SignedParts> + <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> + <sp:Body/> + <sp:Header Name="VitalHeader" Namespace="http://sample.com"/> + </sp:EncryptedParts> + <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-31.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/trunk/modules/rampart-integration/src/test/resources/rampart/services-31.xml?rev=1052173&view=auto ============================================================================== --- axis/axis2/java/rampart/trunk/modules/rampart-integration/src/test/resources/rampart/services-31.xml (added) +++ axis/axis2/java/rampart/trunk/modules/rampart-integration/src/test/resources/rampart/services-31.xml Thu Dec 23 05:50:47 2010 @@ -0,0 +1,111 @@ +<?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="SecureService31"> + + <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="EncrSig" 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://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> + <wsp:Policy> + <sp:InitiatorToken> + <wsp:Policy> + <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient"> + <wsp:Policy> + <sp:WssX509V3Token10/> + </wsp:Policy> + </sp:X509Token> + </wsp:Policy> + </sp:InitiatorToken> + <sp:RecipientToken> + <wsp:Policy> + <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/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://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> + <wsp:Policy> + <sp:MustSupportRefKeyIdentifier/> + <sp:MustSupportRefIssuerSerial/> + </wsp:Policy> + </sp:Wss10> + <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> + <sp:Body/> + <sp:Header Name="VitalHeader" Namespace="http://sample.com"/> + </sp:SignedParts> + <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> + <sp:Body/> + <sp:Header Name="VitalHeader" Namespace="http://sample.com"/> + </sp:EncryptedParts> + + <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>