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/17 21:18:10 UTC

svn commit: r422806 - in /webservices/axis2/trunk/java/modules: integration/test/org/apache/rahas/ rahas/src/org/apache/rahas/ rahas/src/org/apache/rahas/impl/

Author: ruchithf
Date: Mon Jul 17 12:18:10 2006
New Revision: 422806

URL: http://svn.apache.org/viewvc?rev=422806&view=rev
Log:
Added a test to test the WS-RX version

Added:
    webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenV1205Test.java
Modified:
    webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenTest.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/TestClient.java
    webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TrustUtil.java
    webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SCTIssuer.java

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=422806&r1=422805&r2=422806&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 17 12:18:10 2006
@@ -84,7 +84,7 @@
 
             rstElem.build();
             
-            OMElement appliesToElem = TrustUtil.createAppliesToElement(RahasConstants.VERSION_05_02, rstElem);
+            OMElement appliesToElem = TrustUtil.createAppliesToElement(rstElem);
             appliesToElem.setText("http://localhost:5555/axis2/services/SecureService");
             
             rstElem = (OMElement)rstElem.detach();
@@ -102,5 +102,9 @@
         assertNotNull("Missing SAML Assertoin", elem);
     }
 
+
+    public String getRequestAction() {
+        return RahasConstants.V_05_02.RST_ACTON_ISSUE;
+    }
 
 }

Added: webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenV1205Test.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenV1205Test.java?rev=422806&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenV1205Test.java (added)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenV1205Test.java Mon Jul 17 12:18:10 2006
@@ -0,0 +1,97 @@
+/*
+ * 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;
+
+/**
+ * RahasSAMLTokenTest with the WS-SX namespaces
+ */
+public class RahasSAMLTokenV1205Test extends TestClient {
+
+    /**
+     * @param name
+     */
+    public RahasSAMLTokenV1205Test(String name) {
+        super(name);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.rahas.TestClient#getRequest()
+     */
+    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);
+            
+            OMElement appliesToElem = TrustUtil.createAppliesToElement(rstElem);
+            appliesToElem.setText("http://localhost:5555/axis2/services/SecureService");
+            
+            return rstElem;
+            
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+    public OutflowConfiguration getClientOutflowConfiguration() {
+        OutflowConfiguration ofc = new OutflowConfiguration();
+
+        ofc.setActionItems("Timestamp Signature");
+        ofc.setUser("alice");
+        ofc.setSignaturePropFile("sec.properties");
+        ofc.setPasswordCallbackClass(PWCallback.class.getName());
+        return ofc;
+    }
+
+    public InflowConfiguration getClientInflowConfiguration() {
+        InflowConfiguration ifc = new InflowConfiguration();
+
+        ifc.setActionItems("Timestamp Signature");
+        ifc.setPasswordCallbackClass(PWCallback.class.getName());
+        ifc.setSignaturePropFile("sec.properties");
+        
+        return ifc;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.rahas.TestClient#getServiceRepo()
+     */
+    public String getServiceRepo() {
+        return "rahas_service_repo_1";
+    }
+    
+    public void validateRsponse(OMElement resp) {
+        OMElement rst = resp.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);
+    }
+
+    public String getRequestAction() {
+        return RahasConstants.V_05_12.RST_ACTON_ISSUE;
+    }
+
+}

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=422806&r1=422805&r2=422806&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 17 12:18:10 2006
@@ -63,7 +63,7 @@
             Options options = new Options();
             options.setTo(new EndpointReference("http://127.0.0.1:" + port + "/axis2/services/SecureService"));
             options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
-            options.setAction(org.apache.rahas.RahasConstants.V_05_02.RST_ACTON_SCT);
+            options.setAction(this.getRequestAction());
             
 
 
@@ -98,6 +98,8 @@
     public abstract InflowConfiguration getClientInflowConfiguration();
     
     public abstract String getServiceRepo();
+    
+    public abstract String getRequestAction();
     
     public abstract void validateRsponse(OMElement resp);
 }

Modified: webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TrustUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TrustUtil.java?rev=422806&r1=422805&r2=422806&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TrustUtil.java (original)
+++ webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TrustUtil.java Mon Jul 17 12:18:10 2006
@@ -182,8 +182,7 @@
         return ltElem;
     }
 
-    public static OMElement createAppliesToElement(
-            int version, OMElement parent) {
+    public static OMElement createAppliesToElement(OMElement parent) {
         return createOMElement(parent, RahasConstants.WSP_NS,
                 RahasConstants.APPLIES_TO_LN,
                 RahasConstants.WSP_PREFIX);

Modified: webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SCTIssuer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SCTIssuer.java?rev=422806&r1=422805&r2=422806&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SCTIssuer.java (original)
+++ webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SCTIssuer.java Mon Jul 17 12:18:10 2006
@@ -38,8 +38,6 @@
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
-import javax.xml.namespace.QName;
-
 import java.security.Principal;
 import java.security.SecureRandom;
 import java.security.cert.X509Certificate;



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