axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ruchi...@apache.org
Subject svn commit: r440255 - in /webservices/axis2/trunk/java/modules/secpolicy: test-resources/ test/org/ test/org/apache/ test/org/apache/ws/ test/org/apache/ws/secpolicy/ test/org/apache/ws/secpolicy/model/
Date Tue, 05 Sep 2006 04:36:51 GMT
Author: ruchithf
Date: Mon Sep  4 21:36:50 2006
New Revision: 440255

URL: http://svn.apache.org/viewvc?view=rev&rev=440255
Log:
Adding a test case to test basic sec policy binding assertions

Added:
    webservices/axis2/trunk/java/modules/secpolicy/test-resources/
    webservices/axis2/trunk/java/modules/secpolicy/test-resources/policy-asymm-binding.xml
    webservices/axis2/trunk/java/modules/secpolicy/test-resources/policy-symm-binding.xml
    webservices/axis2/trunk/java/modules/secpolicy/test-resources/policy-transport-binding.xml
    webservices/axis2/trunk/java/modules/secpolicy/test/org/
    webservices/axis2/trunk/java/modules/secpolicy/test/org/apache/
    webservices/axis2/trunk/java/modules/secpolicy/test/org/apache/ws/
    webservices/axis2/trunk/java/modules/secpolicy/test/org/apache/ws/secpolicy/
    webservices/axis2/trunk/java/modules/secpolicy/test/org/apache/ws/secpolicy/model/
    webservices/axis2/trunk/java/modules/secpolicy/test/org/apache/ws/secpolicy/model/SecpolicyModelTest.java

Added: webservices/axis2/trunk/java/modules/secpolicy/test-resources/policy-asymm-binding.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/secpolicy/test-resources/policy-asymm-binding.xml?view=auto&rev=440255
==============================================================================
--- webservices/axis2/trunk/java/modules/secpolicy/test-resources/policy-asymm-binding.xml
(added)
+++ webservices/axis2/trunk/java/modules/secpolicy/test-resources/policy-asymm-binding.xml
Mon Sep  4 21:36:50 2006
@@ -0,0 +1,46 @@
+<wsp:Policy wsu:Id="1" 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:Basic256/>
+						</wsp:Policy>
+					</sp:AlgorithmSuite>
+					<sp:Layout>
+						<wsp:Policy>
+							<sp:Lax/>
+						</wsp:Policy>
+					</sp:Layout>
+					<sp:IncludeTimestamp/>
+					<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>
+		</wsp:All>
+	</wsp:ExactlyOne>
+</wsp:Policy>

Added: webservices/axis2/trunk/java/modules/secpolicy/test-resources/policy-symm-binding.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/secpolicy/test-resources/policy-symm-binding.xml?view=auto&rev=440255
==============================================================================
--- webservices/axis2/trunk/java/modules/secpolicy/test-resources/policy-symm-binding.xml
(added)
+++ webservices/axis2/trunk/java/modules/secpolicy/test-resources/policy-symm-binding.xml
Mon Sep  4 21:36:50 2006
@@ -0,0 +1,53 @@
+<wsp:Policy wsu:Id="3" 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:SymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+				<wsp:Policy>
+					<sp:ProtectionToken>
+						<wsp:Policy>
+							<sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+								<wsp:Policy>
+									<sp:RequireDerivedKeys/>
+									<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:Strict/>
+						</wsp:Policy>
+					</sp:Layout>
+					<sp:IncludeTimestamp/>
+					<sp:EncryptSignature/>
+					<sp:OnlySignEntireHeadersAndBody/>
+				</wsp:Policy>
+			</sp:SymmetricBinding>
+			<sp:EndorsingSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+				<wsp:Policy>
+					<sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+						<wsp:Policy>
+							<sp:RequireThumbprintReference/>
+							<sp:WssX509V3Token10/>
+						</wsp:Policy>
+					</sp:X509Token>
+				</wsp:Policy>
+			</sp:EndorsingSupportingTokens>
+			<sp:Wss11 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+				<wsp:Policy>
+					<sp:MustSupportRefKeyIdentifier/>
+					<sp:MustSupportRefIssuerSerial/>
+					<sp:MustSupportRefThumbprint/>
+					<sp:MustSupportRefEncryptedKey/>
+					<sp:RequireSignatureConfirmation/>
+				</wsp:Policy>
+			</sp:Wss11>
+		</wsp:All>
+	</wsp:ExactlyOne>
+</wsp:Policy>

Added: webservices/axis2/trunk/java/modules/secpolicy/test-resources/policy-transport-binding.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/secpolicy/test-resources/policy-transport-binding.xml?view=auto&rev=440255
==============================================================================
--- webservices/axis2/trunk/java/modules/secpolicy/test-resources/policy-transport-binding.xml
(added)
+++ webservices/axis2/trunk/java/modules/secpolicy/test-resources/policy-transport-binding.xml
Mon Sep  4 21:36:50 2006
@@ -0,0 +1,43 @@
+<wsp:Policy wsu:Id="2" 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:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+				<wsp:Policy>
+					<sp:TransportToken>
+						<wsp:Policy>
+							<sp:HttpsToken RequireClientCertificate="false"/>
+						</wsp:Policy>
+					</sp:TransportToken>
+					<sp:AlgorithmSuite>
+						<wsp:Policy>
+							<sp:Basic256/>
+						</wsp:Policy>
+					</sp:AlgorithmSuite>
+					<sp:Layout>
+						<wsp:Policy>
+							<sp:Lax/>
+						</wsp:Policy>
+					</sp:Layout>
+					<sp:IncludeTimestamp/>
+				</wsp:Policy>
+			</sp:TransportBinding>
+			<sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+				<wsp:Policy>
+					<sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+						<wsp:Policy>
+							<sp:WssUsernameToken10/>
+						</wsp:Policy>
+					</sp:UsernameToken>
+				</wsp:Policy>
+			</sp:SignedSupportingTokens>
+			<sp:Wss11 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+				<wsp:Policy>
+					<sp:MustSupportRefKeyIdentifier/>
+					<sp:MustSupportRefIssuerSerial/>
+					<sp:MustSupportRefThumbprint/>
+					<sp:MustSupportRefEncryptedKey/>
+				</wsp:Policy>
+			</sp:Wss11>
+		</wsp:All>
+	</wsp:ExactlyOne>
+</wsp:Policy>

Added: webservices/axis2/trunk/java/modules/secpolicy/test/org/apache/ws/secpolicy/model/SecpolicyModelTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/secpolicy/test/org/apache/ws/secpolicy/model/SecpolicyModelTest.java?view=auto&rev=440255
==============================================================================
--- webservices/axis2/trunk/java/modules/secpolicy/test/org/apache/ws/secpolicy/model/SecpolicyModelTest.java
(added)
+++ webservices/axis2/trunk/java/modules/secpolicy/test/org/apache/ws/secpolicy/model/SecpolicyModelTest.java
Mon Sep  4 21:36:50 2006
@@ -0,0 +1,62 @@
+/*
+ * 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.ws.secpolicy.model;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.neethi.Policy;
+import org.apache.neethi.PolicyEngine;
+
+import junit.framework.TestCase;
+
+public class SecpolicyModelTest extends TestCase {
+    
+    
+    public void testSymmBinding() {
+        try {
+            Policy p = this.getPolicy("test-resources/policy-symm-binding.xml");
+            
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+    
+    public void testAsymmBinding() {
+        try {
+            this.getPolicy("test-resources/policy-asymm-binding.xml");
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+    
+    public void testTransportBinding() {
+        try {
+            this.getPolicy("test-resources/policy-transport-binding.xml");
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+    
+    private Policy getPolicy(String filePath) throws Exception {
+        StAXOMBuilder builder = new StAXOMBuilder(filePath);
+        OMElement elem = builder.getDocumentElement();
+        return PolicyEngine.getPolicy(elem);
+    }
+}



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


Mime
View raw message