You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ru...@apache.org on 2006/07/24 16:28:46 UTC

svn commit: r425063 - in /webservices/axis2/trunk/java/modules/integration: ./ test-resources/rahas/ test/org/apache/rahas/

Author: ruchithf
Date: Mon Jul 24 07:28:46 2006
New Revision: 425063

URL: http://svn.apache.org/viewvc?rev=425063&view=rev
Log:
Added two more SAMLToken issuer test cases. Both these requests for a SAMLToken from the STS based authenticating the clients with a UsernameToken. The difference is that they are using different versions of WS-Trust


Added:
    webservices/axis2/trunk/java/modules/integration/test-resources/rahas/s3-services.xml
    webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenUTForHoKTest.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenUTForHoKV1205Test.java
Modified:
    webservices/axis2/trunk/java/modules/integration/maven.xml
    webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenTest.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/TestClient.java

Modified: webservices/axis2/trunk/java/modules/integration/maven.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/maven.xml?rev=425063&r1=425062&r2=425063&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/maven.xml (original)
+++ webservices/axis2/trunk/java/modules/integration/maven.xml Mon Jul 24 07:28:46 2006
@@ -357,7 +357,33 @@
 
 			<!-- Rahas Test1: SAML Token test : END -->
 
-		
+
+			<!-- Rahas Test 3 & 4: RahasSAMLTokenUTForHoKTest and RahasSAMLTokenUTForHoKV1205Test -->
+            <mkdir dir="target/test-resources/rahas_service_repo_3"/>
+            <mkdir dir="target/test-resources/rahas_service_repo_3/conf"/>
+            <mkdir dir="target/test-resources/rahas_service_repo_3/services"/>
+            <mkdir dir="target/test-resources/rahas_service_repo_3/modules"/>
+
+            <copy file="../security/target/rampart-${rampart_version}.mar"
+                  tofile="target/test-resources/rahas_service_repo_3/modules/rampart-${rampart_version}.mar"/>
+		    <copy file="../rahas/target/rahas-${rahas_version}.mar"
+                  tofile="target/test-resources/rahas_service_repo_3/modules/rahas-${rahas_version}.mar"/>
+            <copy file="../addressing/target/addressing-${addressing_version}.mar"
+                  tofile="target/test-resources/rahas_service_repo_3/modules/addressing-${addressing_version}.mar"/>
+				  
+				  
+			<!-- copy the services.xml and create the aar -->
+			<copy overwrite="yes" file="test-resources/rahas/s3-services.xml"
+                  tofile="target/temp-rahas/META-INF/services.xml"/>
+			<copy overwrite="yes" file="test-resources/rahas/sctIssuer.properties"
+                  tofile="target/temp-rahas/sctIssuer.properties"/>
+
+		    <jar  overwrite="yes" jarfile="target/test-resources/rahas_service_repo_3/services/SecureService.aar"
+                 basedir="target/temp-rahas"/>
+
+			<!-- Rahas Test 3 & 4: RahasSAMLTokenUTForHoKTest and RahasSAMLTokenUTForHoKV1205Test : END-->
+
+
 			<mkdir dir="target/test-resources/samples/modules"/>
             <mkdir dir="target/test-resources/samples/conf"/>
             <mkdir dir="target/test-resources/repository-client/modules"/>

Added: webservices/axis2/trunk/java/modules/integration/test-resources/rahas/s3-services.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test-resources/rahas/s3-services.xml?rev=425063&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test-resources/rahas/s3-services.xml (added)
+++ webservices/axis2/trunk/java/modules/integration/test-resources/rahas/s3-services.xml Mon Jul 24 07:28:46 2006
@@ -0,0 +1,48 @@
+<service name="SecureService">
+
+	<module ref="rampart"/>
+	<module ref="rahas"/>
+
+	<parameter locked="false" name="ServiceClass">org.apache.axis2.security.sc.Service</parameter>
+
+	<operation name="echo">
+		<messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+		<actionMapping>urn:echo</actionMapping>
+	</operation>    
+
+    <parameter name="saml-issuer-config">
+		<saml-issuer-config>
+			<issuerName>Test_STS</issuerName>
+			<issuerKeyAlias>sts</issuerKeyAlias>
+			<issuerKeyPassword>password</issuerKeyPassword>
+			<cryptoProperties>sctIssuer.properties</cryptoProperties>
+			<timeToLive>300000</timeToLive>
+			<keySize>256</keySize>
+			<addRequestedAttachedRef />
+			<addRequestedUnattachedRef />
+			<trusted-services>
+				<service alias="bob">http://localhost:5555/axis2/services/SecureService</service>
+				<service alias="bob1">http://localhost:5555/axis2/services/SecureService1</service>
+				<service alias="bob2">http://localhost:5555/axis2/services/SecureService2</service>
+				<service alias="bob3">http://localhost:5555/axis2/services/SecureService3</service>
+			</trusted-services>
+		</saml-issuer-config>
+    </parameter>
+	
+	<parameter name="InflowSecurity">
+      <action>
+        <items>Timestamp UsernameToken</items>
+		<passwordCallbackClass xmlns="">org.apache.axis2.security.sc.PWCallback</passwordCallbackClass>
+      </action>
+    </parameter>
+
+    <parameter name="OutflowSecurity">
+      <action>
+        <items>Timestamp</items>
+        <user>sts</user>
+	    <passwordCallbackClass xmlns="">org.apache.axis2.security.sc.PWCallback</passwordCallbackClass>
+		<enableSignatureConfirmation>false</enableSignatureConfirmation>
+      </action>
+    </parameter>
+    
+</service>

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenTest.java?rev=425063&r1=425062&r2=425063&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenTest.java Mon Jul 24 07:28:46 2006
@@ -60,9 +60,6 @@
         return ifc;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.rahas.TestClient#getServiceRepo()
-     */
     public String getServiceRepo() {
         return "rahas_service_repo_1";
     }

Added: webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenUTForHoKTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenUTForHoKTest.java?rev=425063&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenUTForHoKTest.java (added)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenUTForHoKTest.java Mon Jul 24 07:28:46 2006
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2004,2005 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.
+ */
+
+package org.apache.rahas;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.security.sc.PWCallback;
+import org.apache.rampart.handler.config.InflowConfiguration;
+import org.apache.rampart.handler.config.OutflowConfiguration;
+import org.opensaml.XML;
+
+import javax.xml.namespace.QName;
+
+public class RahasSAMLTokenUTForHoKTest extends TestClient {
+
+    public RahasSAMLTokenUTForHoKTest(String name) {
+        super(name);
+    }
+
+    public OMElement getRequest() {
+        try {
+            OMElement rstElem = TrustUtil.createRequestSecurityTokenElement(RahasConstants.VERSION_05_02);
+            OMElement reqTypeElem = TrustUtil.createRequestTypeElement(RahasConstants.VERSION_05_02, rstElem);
+            OMElement tokenTypeElem = TrustUtil.createTokenTypeElement(RahasConstants.VERSION_05_02, rstElem);
+            reqTypeElem.setText(RahasConstants.V_05_12.REQ_TYPE_ISSUE);
+            tokenTypeElem.setText(RahasConstants.TOK_TYPE_SAML_10);
+            
+            TrustUtil.createAppliesToElement(rstElem,
+                    "http://localhost:5555/axis2/services/SecureService");
+            TrustUtil.createKeyTypeElement(RahasConstants.VERSION_05_02,
+                    rstElem, RahasConstants.KEY_TYPE_SYMM_KEY);
+            TrustUtil.createKeySizeElement(RahasConstants.VERSION_05_02, rstElem, 256);
+            
+            return rstElem;
+            
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    public OutflowConfiguration getClientOutflowConfiguration() {
+        OutflowConfiguration ofc = new OutflowConfiguration();
+
+        ofc.setActionItems("Timestamp UsernameToken");
+        ofc.setUser("Ron");
+        ofc.setPasswordCallbackClass(PWCallback.class.getName());
+        return ofc;
+    }
+
+    public InflowConfiguration getClientInflowConfiguration() {
+        InflowConfiguration ifc = new InflowConfiguration();
+
+        ifc.setActionItems("Timestamp");
+        
+        return ifc;
+    }
+
+    public String getServiceRepo() {
+        return "rahas_service_repo_3";
+    }
+
+    public String getRequestAction() {
+        return RahasConstants.V_05_02.RST_ACTON_ISSUE;
+    }
+
+    public void validateRsponse(OMElement resp) {
+        OMElement rst = resp.getFirstChildWithName(new QName(RahasConstants.WST_NS_05_02, RahasConstants.REQUESTED_SECURITY_TOKEN_LN));
+        assertNotNull("RequestedSecurityToken missing", rst);
+        OMElement elem = rst.getFirstChildWithName(new QName(XML.SAML_NS, "Assertion"));
+        assertNotNull("Missing SAML Assertoin", elem);
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenUTForHoKV1205Test.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenUTForHoKV1205Test.java?rev=425063&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenUTForHoKV1205Test.java (added)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenUTForHoKV1205Test.java Mon Jul 24 07:28:46 2006
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2004,2005 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.
+ */
+
+package org.apache.rahas;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.security.sc.PWCallback;
+import org.apache.rampart.handler.config.InflowConfiguration;
+import org.apache.rampart.handler.config.OutflowConfiguration;
+import org.opensaml.XML;
+
+import javax.xml.namespace.QName;
+
+public class RahasSAMLTokenUTForHoKV1205Test extends TestClient {
+
+    /**
+     * @param name
+     */
+    public RahasSAMLTokenUTForHoKV1205Test(String name) {
+        super(name);
+    }
+
+    public OMElement getRequest() {
+        try {
+            OMElement rstElem = TrustUtil.createRequestSecurityTokenElement(RahasConstants.VERSION_05_12);
+            OMElement reqTypeElem = TrustUtil.createRequestTypeElement(RahasConstants.VERSION_05_12, rstElem);
+            OMElement tokenTypeElem = TrustUtil.createTokenTypeElement(RahasConstants.VERSION_05_12, rstElem);
+            reqTypeElem.setText(RahasConstants.V_05_12.REQ_TYPE_ISSUE);
+            tokenTypeElem.setText(RahasConstants.TOK_TYPE_SAML_10);
+            
+            TrustUtil.createAppliesToElement(rstElem,
+                    "http://localhost:5555/axis2/services/SecureService");
+            TrustUtil.createKeyTypeElement(RahasConstants.VERSION_05_12,
+                    rstElem, RahasConstants.KEY_TYPE_SYMM_KEY);
+            TrustUtil.createKeySizeElement(RahasConstants.VERSION_05_12, rstElem, 256);
+            
+            return rstElem;
+            
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    public OutflowConfiguration getClientOutflowConfiguration() {
+        OutflowConfiguration ofc = new OutflowConfiguration();
+
+        ofc.setActionItems("Timestamp UsernameToken");
+        ofc.setUser("Ron");
+        ofc.setPasswordCallbackClass(PWCallback.class.getName());
+        return ofc;
+    }
+
+    public InflowConfiguration getClientInflowConfiguration() {
+        InflowConfiguration ifc = new InflowConfiguration();
+
+        ifc.setActionItems("Timestamp");
+        
+        return ifc;
+    }
+
+    public String getServiceRepo() {
+        return "rahas_service_repo_3";
+    }
+
+    public String getRequestAction() {
+        return RahasConstants.V_05_12.RST_ACTON_ISSUE;
+    }
+
+    public void validateRsponse(OMElement resp) {
+        OMElement rstr = resp.getFirstChildWithName(new QName(RahasConstants.WST_NS_05_12, RahasConstants.REQUEST_SECURITY_TOKEN_RESPONSE_LN));
+        assertNotNull("RequestedSecurityToken missing", rstr);
+        OMElement rst = rstr.getFirstChildWithName(new QName(RahasConstants.WST_NS_05_12, RahasConstants.REQUESTED_SECURITY_TOKEN_LN));
+        assertNotNull("RequestedSecurityToken missing", rst);
+        OMElement elem = rst.getFirstChildWithName(new QName(XML.SAML_NS, "Assertion"));
+        assertNotNull("Missing SAML Assertoin", elem);
+    }
+
+}

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/TestClient.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/TestClient.java?rev=425063&r1=425062&r2=425063&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/TestClient.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/TestClient.java Mon Jul 24 07:28:46 2006
@@ -51,7 +51,7 @@
     /**
      * @param args
      */
-    public void testConversation() {
+    public void testRequest() {
         try {
 
             // Get the repository location from the args



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org