axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ruchi...@apache.org
Subject svn commit: r371870 [1/4] - in /webservices/axis2/trunk/java/modules/security: ./ src/org/apache/axis2/security/ src/org/apache/axis2/security/handler/config/ src/org/apache/ws/ src/org/apache/ws/security/ src/org/apache/ws/security/policy/ src/org/apa...
Date Tue, 24 Jan 2006 09:14:27 GMT
Author: ruchithf
Date: Tue Jan 24 01:13:40 2006
New Revision: 371870

URL: http://svn.apache.org/viewcvs?rev=371870&view=rev
Log:
- Code for a security policy model which is populated using Werner's security policy parser in the ws-commons/policy project
- Imported the code (slightly modified and the doAssertion* methods populated) of the security policy parser
- Added a test case to browse the security policy model
- Changed OutflowConfiguration to allow setting of the signature algorithm


Added:
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/SecurityModule.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/Constants.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/WSS4JConfig.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/WSS4JConfigBuilder.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/WSSPolicyException.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/AlgorithmSuite.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/AlgorithmWrapper.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/AsymmetricBinding.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/Binding.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/EncryptionToken.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/Header.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/InitiatorToken.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/Layout.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/PolicyEngineData.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/ProtectionToken.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/RecipientToken.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/RootPolicyEngineData.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/SignatureToken.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/SignedEncryptedElements.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/SignedEncryptedParts.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/SupportingToken.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/SymmetricAsymmetricBindingBase.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/SymmetricBinding.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/Token.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/TokenWrapper.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/TransportBinding.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/UsernameToken.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/Wss10.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/Wss11.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/X509Token.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/parser/
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/parser/SecurityPolicy.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/parser/SecurityPolicyToken.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/parser/SecurityProcessorContext.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/parser/WSSPolicyProcessor.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/parser/package.html
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/parser/processors/
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/parser/processors/AlgorithmSuiteProcessor.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/parser/processors/AsymmetricBindingProcessor.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/parser/processors/EncryptedPartsElementsProcessor.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/parser/processors/EndorsingSupportingTokensProcessor.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/parser/processors/InitiatorRecipientTokenProcessor.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/parser/processors/LayoutProcessor.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/parser/processors/SignEncProtectTokenProcessor.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/parser/processors/SignedEndorsingSupportingTokensProcessor.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/parser/processors/SignedPartsElementsProcessor.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/parser/processors/SignedSupportingTokensProcessor.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/parser/processors/SupportingTokensProcessor.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/parser/processors/SymmetricBindingProcessor.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/parser/processors/Trust10Processor.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/parser/processors/UsernameTokenProcessor.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/parser/processors/Wss10Processor.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/parser/processors/Wss11Processor.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/parser/processors/X509TokenProcessor.java
    webservices/axis2/trunk/java/modules/security/test-resources/policy/
    webservices/axis2/trunk/java/modules/security/test-resources/policy/SecurityPolicyBindings.xml
    webservices/axis2/trunk/java/modules/security/test-resources/policy/SecurityPolicyBindingsSymm.xml
    webservices/axis2/trunk/java/modules/security/test-resources/policy/SecurityPolicyMsg.xml
    webservices/axis2/trunk/java/modules/security/test/org/apache/ws/
    webservices/axis2/trunk/java/modules/security/test/org/apache/ws/security/
    webservices/axis2/trunk/java/modules/security/test/org/apache/ws/security/policy/
    webservices/axis2/trunk/java/modules/security/test/org/apache/ws/security/policy/parser/
    webservices/axis2/trunk/java/modules/security/test/org/apache/ws/security/policy/parser/WSSPolicyProcessorTest.java
Modified:
    webservices/axis2/trunk/java/modules/security/project.xml
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/handler/config/OutflowConfiguration.java

Modified: webservices/axis2/trunk/java/modules/security/project.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/project.xml?rev=371870&r1=371869&r2=371870&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/project.xml (original)
+++ webservices/axis2/trunk/java/modules/security/project.xml Tue Jan 24 01:13:40 2006
@@ -200,6 +200,15 @@
             <artifactId>XmlSchema</artifactId>
             <version>${XmlSchema.version}</version>
         </dependency>
+	<!-- For WS-Policy support -->
+	<dependency>
+		<groupId>ws-commons</groupId>
+		<artifactId>ws-policy</artifactId>
+		<version>${ws_policy.version}</version>
+		<properties>
+			<module>true</module>
+		</properties>
+	</dependency>
     </dependencies>
 
     <reports/>

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/SecurityModule.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/SecurityModule.java?rev=371870&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/SecurityModule.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/SecurityModule.java Tue Jan 24 01:13:40 2006
@@ -0,0 +1,52 @@
+/*
+ * 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.axis2.security;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.description.AxisDescription;
+import org.apache.axis2.description.AxisModule;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.modules.Module;
+
+public class SecurityModule implements Module {
+
+    /* (non-Javadoc)
+     * @see org.apache.axis2.modules.Module#engageNotify(org.apache.axis2.description.AxisDescription)
+     */
+    public void engageNotify(AxisDescription axisDescription) throws AxisFault {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.axis2.modules.Module#shutdown(org.apache.axis2.engine.AxisConfiguration)
+     */
+    public void shutdown(AxisConfiguration axisSystem) throws AxisFault {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.axis2.modules.Module#init(org.apache.axis2.context.ConfigurationContext, org.apache.axis2.description.AxisModule)
+     */
+    public void init(ConfigurationContext configContext, AxisModule module) throws AxisFault {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+}

Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/handler/config/OutflowConfiguration.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/handler/config/OutflowConfiguration.java?rev=371870&r1=371869&r2=371870&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/handler/config/OutflowConfiguration.java (original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/handler/config/OutflowConfiguration.java Tue Jan 24 01:13:40 2006
@@ -218,6 +218,16 @@
 		return (String) this.actionList[this.currentAction]
 				.get(WSHandlerConstants.SIG_KEY_ID);
 	}
+    
+    public void setSignatureAlgorithm(String signatureAlgo) {
+        this.actionList[this.currentAction].put(WSHandlerConstants.SIG_ALGO,
+                signatureAlgo);
+    }
+    
+    public String getSignatureAlgorithm() {
+        return (String) this.actionList[this.currentAction]
+                .get(WSHandlerConstants.SIG_ALGO);
+    }
 	
 	/**
 	 * Sets the encrypted key identifier of the current action.

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/Constants.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/Constants.java?rev=371870&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/Constants.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/Constants.java Tue Jan 24 01:13:40 2006
@@ -0,0 +1,167 @@
+/*
+ * 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.security.policy;
+
+public class Constants {
+
+    public final static String SP_NS = "http://schemas.xmlsoap.org/ws/2005/07/securitypolicy";
+    
+    public final static String ATTR_INCLUDE_TOKEN = "IncludeToken";
+
+    public final static String INCLUDE_NEVER = Constants.SP_NS
+            + "/IncludeToken/Never";
+
+    public final static String INCLUDE_ONCE = Constants.SP_NS
+            + "/IncludeToken/Once";
+
+    public final static String INCLUDE_ALWAYS_TO_RECIPIENT = Constants.SP_NS
+            + "/IncludeToken/AlwaysToRecipient";
+
+    public final static String INCLUDE_ALWAYS = Constants.SP_NS
+            + "/IncludeToken/Always";
+
+    
+    public final static int SUPPORTING_TOKEN_SUPPORTING = 1;
+    public final static int SUPPORTING_TOKEN_ENDORSING = 2;
+    public final static int SUPPORTING_TOKEN_SIGNED = 3;
+    public final static int SUPPORTING_TOKEN_SIGNED_ENDORSING = 4;
+    
+    /**
+     * Security Header Layout : Strict
+     */
+    public final static String LAYOUT_STRICT = "Strict";
+
+    /**
+     * Security Header Layout : Lax
+     */
+    public final static String LAYOUT_LAX = "Lax";
+
+    /**
+     * Security Header Layout : LaxTimestampFirst
+     */
+    public final static String LAYOUT_LAX_TIMESTAMP_FIRST = "LaxTimestampFirst";
+
+    /**
+     * Security Header Layout : LaxTimestampLast
+     */
+    public final static String LAYOUT_LAX_TIMESTAMP_LAST = "LaxTimestampLast";
+    
+    /**
+     * Protection Order : EncryptBeforeSigning
+     */
+    public final static String ENCRYPT_BEFORE_SIGNING = "EncryptBeforeSigning";
+
+    /**
+     * Protection Order : SignBeforeEncrypting
+     */
+    public final static String SIGN_BEFORE_ENCRYPTING = "SignBeforeEncrypting";
+    
+    public final static String WSS_X509_V1_TOKEN10 = "WssX509V1Token10";
+    
+    public final static String WSS_X509_V3_TOKEN10 = "WssX509V3Token10";
+    
+    public final static String WSS_X509_PKCS7_TOKEN10 = "WssX509Pkcs7Token10";
+    
+    public final static String WSS_X509_PKI_PATH_V1_TOKEN10 = 
+                                                    "WssX509PkiPathV1Token10";
+    
+    public final static String WSS_X509_V1_TOKEN11 = "WssX509V1Token11";
+    
+    public final static String WSS_X509_V3_TOKEN11 = "WssX509V3Token11";
+    
+    public final static String WSS_X509_PKCS7_TOKEN11 = "WssX509Pkcs7Token11";
+    
+    public final static String WSS_X509_PKI_PATH_V1_TOKEN11 = 
+                                                    "WssX509PkiPathV1Token11";
+    
+    ///
+    ///Algorithm Suites
+    ///
+    public final static String ALGO_SUITE_BASIC256 = "Basic256";
+    public final static String ALGO_SUITE_BASIC192 = "Basic192";
+    public final static String ALGO_SUITE_BASIC128 = "Basic128";
+    public final static String ALGO_SUITE_TRIPLE_DES = "TripleDes";
+    public final static String ALGO_SUITE_BASIC256_RSA15 = "Basic256Rsa15";
+    public final static String ALGO_SUITE_BASIC192_RSA15 = "Basic192Rsa15";
+    public final static String ALGO_SUITE_BASIC128_RSA15 = "Basic128Rsa15";
+    public final static String ALGO_SUITE_TRIPLE_DES_RSA15 = "TripleDesRsa15";
+    public final static String ALGO_SUITE_BASIC256_SHA256 = "Basic256Sha256";
+    public final static String ALGO_SUITE_BASIC192_SHA256 = "Basic192Sha256";
+    public final static String ALGO_SUITE_BASIC128_SHA256 = "Basic128Sha256";
+    public final static String ALGO_SUITE_TRIPLE_DES_SHA256 = "TripleDesSha256";
+    public final static String ALGO_SUITE_BASIC256_SHA256_RSA15 = 
+                                                        "Basic256Sha256Rsa15";
+    public final static String ALGO_SUITE_BASIC192_SHA256_RSA15 = 
+                                                        "Basic192Sha256Rsa15";
+    public final static String ALGO_SUITE_BASIC128_SHA256_RSA15 = 
+                                                        "Basic128Sha256Rsa15";
+    public final static String ALGO_SUITE_TRIPLE_DES_SHA256_RSA15 = 
+                                                        "TripleDesSha256Rsa15";
+    
+    ///
+    ///Algorithms
+    ///
+    public final static String HMAC_SHA1 = "http://www.w3.org/2000/09/xmldsig#hmac-sha1";
+
+    public final static String RSA_SHA1 = "http://www.w3.org/2000/09/xmldsig#rsa-sha1";
+
+    public final static String SHA1 = "http://www.w3.org/2000/09/xmldsig#sha1";
+
+    public final static String SHA256 = "http://www.w3.org/2001/04/xmlenc#sha256";
+
+    public final static String SHA512 = "http://www.w3.org/2001/04/xmlenc#sha512";
+
+    public final static String AES128 = "http://www.w3.org/2001/04/xmlenc#aes128-cbc";
+
+    public final static String AES192 = "http://www.w3.org/2001/04/xmlenc#aes192-cbc";
+
+    public final static String AES256 = "http://www.w3.org/2001/04/xmlenc#aes256-cbc";
+
+    public final static String TRIPLE_DES = "http://www.w3.org/2001/04/xmlenc#tripledes-cbc";
+
+    public final static String KW_AES128 = "http://www.w3.org/2001/04/xmlenc#kw-aes256";
+
+    public final static String KW_AES192 = "http://www.w3.org/2001/04/xmlenc#kw-aes192";
+
+    public final static String KW_AES256 = "http://www.w3.org/2001/04/xmlenc#kw-aes128";
+
+    public final static String KW_TRIPLE_DES = "http://www.w3.org/2001/04/xmlenc#kw-tripledes";
+
+    public final static String KW_RSA_OAEP = "http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p";
+
+    public final static String KW_RSA15 = "http://www.w3.org/2001/04/xmlenc#rsa-1_5";
+
+    public final static String P_SHA1 = "http://schemas.xmlsoap.org/ws/2005/02/sc/dk/p_sha1";
+
+    public final static String P_SHA1_L128 = "http://schemas.xmlsoap.org/ws/2005/02/sc/dk/p_sha1";
+
+    public final static String P_SHA1_L192 = "http://schemas.xmlsoap.org/ws/2005/02/sc/dk/p_sha1";
+
+    public final static String P_SHA1_L256 = "http://schemas.xmlsoap.org/ws/2005/02/sc/dk/p_sha1";
+
+    public final static String XPATH = "http://www.w3.org/TR/1999/REC-xpath-19991116";
+
+    public final static String XPATH20 = "http://www.w3.org/2002/06/xmldsig-filter2";
+
+    public final static String C14N = "http://www.w3.org/2001/10/xml-c14n#";
+
+    public final static String EX_C14N = "http://www.w3.org/2001/10/xml-exc-c14n#";
+
+    public final static String SNT = "http://www.w3.org/TR/soap12-n11n";
+
+    public final static String STRT10 = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#STR-Transform";
+}

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/WSS4JConfig.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/WSS4JConfig.java?rev=371870&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/WSS4JConfig.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/WSS4JConfig.java Tue Jan 24 01:13:40 2006
@@ -0,0 +1,52 @@
+/*
+ * 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.security.policy;
+
+import org.apache.axis2.security.handler.config.InflowConfiguration;
+import org.apache.axis2.security.handler.config.OutflowConfiguration;
+
+public class WSS4JConfig {
+
+    private OutflowConfiguration outflowConfiguration;
+    private InflowConfiguration inflowConfiguration;
+    
+    /**
+     * @return Returns the inflowConfiguration.
+     */
+    public InflowConfiguration getInflowConfiguration() {
+        return inflowConfiguration;
+    }
+    /**
+     * @param inflowConfiguration The inflowConfiguration to set.
+     */
+    public void setInflowConfiguration(InflowConfiguration inflowConfiguration) {
+        this.inflowConfiguration = inflowConfiguration;
+    }
+    /**
+     * @return Returns the outflowConfiguration.
+     */
+    public OutflowConfiguration getOutflowConfiguration() {
+        return outflowConfiguration;
+    }
+    /**
+     * @param outflowConfiguration The outflowConfiguration to set.
+     */
+    public void setOutflowConfiguration(OutflowConfiguration outflowConfiguration) {
+        this.outflowConfiguration = outflowConfiguration;
+    }
+    
+}

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/WSS4JConfigBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/WSS4JConfigBuilder.java?rev=371870&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/WSS4JConfigBuilder.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/WSS4JConfigBuilder.java Tue Jan 24 01:13:40 2006
@@ -0,0 +1,71 @@
+/*
+ * 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.security.policy;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.apache.ws.security.policy.model.AsymmetricBinding;
+import org.apache.ws.security.policy.model.Binding;
+import org.apache.ws.security.policy.model.PolicyEngineData;
+import org.apache.ws.security.policy.model.SymmetricBinding;
+import org.apache.ws.security.policy.model.Wss10;
+import org.apache.ws.security.policy.model.Wss11;
+
+public class WSS4JConfigBuilder {
+    
+    public static void build(ArrayList topLevelPeds) throws WSSPolicyException {
+        Iterator topLevelPEDIterator = topLevelPeds.iterator();
+        WSS4JConfig config = new WSS4JConfig();
+        while (topLevelPEDIterator.hasNext()) {
+            PolicyEngineData ped = (PolicyEngineData) topLevelPEDIterator.next();
+            if(ped instanceof Binding) {
+                if(ped instanceof SymmetricBinding) {
+                    processSymmetricPolicyBinding((SymmetricBinding)ped, config);
+                } else {
+                    processAsymmetricPolicyBinding((AsymmetricBinding)ped, config);
+                }
+            } else if(ped instanceof Wss10) {
+                processWSS10((Wss10)ped, config);
+            } else if(ped instanceof Wss11) {
+                processWSS11((Wss11)ped, config);
+            }
+        }
+    }
+    
+
+    private static void processSymmetricPolicyBinding(SymmetricBinding symmbinding, WSS4JConfig config) {
+        //TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+    
+    private static void processWSS10(Wss10 wss10, WSS4JConfig config) {
+        //TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+    private static void processAsymmetricPolicyBinding(AsymmetricBinding binding, WSS4JConfig config) {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+    
+    private static void processWSS11(Wss11 wss11, WSS4JConfig config) {
+       if(wss11.isRequireSignatureConfirmation()) {
+           config.getInflowConfiguration().setEnableSignatureConfirmation(true);
+           config.getOutflowConfiguration().setEnableSignatureConfirmation(true);
+       }
+    }
+    
+}

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/WSSPolicyException.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/WSSPolicyException.java?rev=371870&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/WSSPolicyException.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/WSSPolicyException.java Tue Jan 24 01:13:40 2006
@@ -0,0 +1,31 @@
+/*
+ * 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.security.policy;
+
+public class WSSPolicyException extends Exception {
+
+    private static final long serialVersionUID = 5904800255533588133L;
+
+    public WSSPolicyException(String message, Throwable e) {
+        super(message, e);
+    }
+
+    public WSSPolicyException(String message) {
+        super(message);
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/AlgorithmSuite.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/AlgorithmSuite.java?rev=371870&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/AlgorithmSuite.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/AlgorithmSuite.java Tue Jan 24 01:13:40 2006
@@ -0,0 +1,364 @@
+/*
+ * 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.security.policy.model;
+
+import org.apache.ws.security.policy.Constants;
+import org.apache.ws.security.policy.WSSPolicyException;
+
+public class AlgorithmSuite extends PolicyEngineData {
+    
+    private String symmetricSignature = Constants.HMAC_SHA1;
+    
+    private String asymmetricSignature = Constants.RSA_SHA1;
+
+    private String computedKey = Constants.P_SHA1;
+
+    private int maximumSymmetricKeyLength = 256;
+    
+    private int minimumAsymmetricKeyLength = 1024;
+    
+    private int maximumAsymmetricKeyLength = 4096;
+
+    private String digest;
+    
+    private String encryption;
+    
+    private String symmetricKeyWrap;
+    
+    private String asymmetricKeyWrap;
+    
+    private String encryptionKeyDerivation;
+    
+    private String signatureKeyDerivation;
+    
+    private int minimumSymmetricKeyLength;
+    
+    private String c14n = Constants.EX_C14N;
+    
+    private String soapNormalization;
+
+    private String strTransform;
+    
+    private String xPath;
+    
+//    public AlgorithmSuite (String algoSuite) throws WSSPolicyException {
+//        this.setAlgorithmSuite(algoSuite);
+//    }
+    
+    /**
+     * Set the algorithm suite
+     * @param algoSuite
+     * @throws WSSPolicyException
+     * @see Constants#ALGO_SUITE_BASIC128
+     * @see Constants#ALGO_SUITE_BASIC128_RSA15
+     * @see Constants#ALGO_SUITE_BASIC128_SHA256
+     * @see Constants#ALGO_SUITE_BASIC128_SHA256_RSA15
+     * @see Constants#ALGO_SUITE_BASIC192
+     * @see Constants#ALGO_SUITE_BASIC192_RSA15
+     * @see Constants#ALGO_SUITE_BASIC192_SHA256
+     * @see Constants#ALGO_SUITE_BASIC192_SHA256_RSA15
+     * @see Constants#ALGO_SUITE_BASIC256
+     * @see Constants#ALGO_SUITE_BASIC256_RSA15
+     * @see Constants#ALGO_SUITE_BASIC256_SHA256
+     * @see Constants#ALGO_SUITE_BASIC256_SHA256_RSA15
+     * @see Constants#ALGO_SUITE_TRIPLE_DES
+     * @see Constants#ALGO_SUITE_TRIPLE_DES_RSA15
+     * @see Constants#ALGO_SUITE_TRIPLE_DES_SHA256
+     * @see Constants#ALGO_SUITE_TRIPLE_DES_SHA256_RSA15
+     */
+    public void setAlgorithmSuite(String algoSuite) throws WSSPolicyException {
+        //TODO: Optimize this :-)
+        if(Constants.ALGO_SUITE_BASIC256.equals(algoSuite)) {
+            this.digest = Constants.SHA1;
+            this.encryption = Constants.AES256;
+            this.symmetricKeyWrap = Constants.KW_AES256;
+            this.asymmetricKeyWrap = Constants.KW_RSA_OAEP;
+            this.encryptionKeyDerivation = Constants.P_SHA1_L256;
+            this.signatureKeyDerivation = Constants.P_SHA1_L192;
+            this.minimumSymmetricKeyLength = 256;
+        } else if (Constants.ALGO_SUITE_BASIC192.equals(algoSuite)) {
+            this.digest = Constants.SHA1;
+            this.encryption = Constants.AES192;
+            this.symmetricKeyWrap = Constants.KW_AES192;
+            this.asymmetricKeyWrap = Constants.KW_RSA_OAEP;
+            this.encryptionKeyDerivation = Constants.P_SHA1_L192;
+            this.signatureKeyDerivation = Constants.P_SHA1_L192;
+            this.minimumSymmetricKeyLength = 192;
+        } else if (Constants.ALGO_SUITE_BASIC128.equals(algoSuite)) {
+            this.digest = Constants.SHA1;
+            this.encryption = Constants.AES128;
+            this.symmetricKeyWrap = Constants.KW_AES128;
+            this.asymmetricKeyWrap = Constants.KW_RSA_OAEP;
+            this.encryptionKeyDerivation = Constants.P_SHA1_L128;
+            this.signatureKeyDerivation = Constants.P_SHA1_L128;
+            this.minimumSymmetricKeyLength = 128;
+        } else if(Constants.ALGO_SUITE_TRIPLE_DES.equals(algoSuite)) {
+            this.digest = Constants.SHA1;
+            this.encryption = Constants.TRIPLE_DES;
+            this.symmetricKeyWrap = Constants.KW_TRIPLE_DES;
+            this.asymmetricKeyWrap = Constants.KW_RSA_OAEP;
+            this.encryptionKeyDerivation = Constants.P_SHA1_L192;
+            this.signatureKeyDerivation = Constants.P_SHA1_L192;
+            this.minimumSymmetricKeyLength = 192;
+        } else if (Constants.ALGO_SUITE_BASIC256_RSA15.equals(algoSuite)) {
+            this.digest = Constants.SHA1;
+            this.encryption = Constants.AES256;
+            this.symmetricKeyWrap = Constants.KW_AES256;
+            this.asymmetricKeyWrap = Constants.KW_RSA15;
+            this.encryptionKeyDerivation = Constants.P_SHA1_L256;
+            this.signatureKeyDerivation = Constants.P_SHA1_L192;
+            this.minimumSymmetricKeyLength = 256;
+        } else if (Constants.ALGO_SUITE_BASIC192_RSA15.equals(algoSuite)) {
+            this.digest = Constants.SHA1;
+            this.encryption = Constants.AES192;
+            this.symmetricKeyWrap = Constants.KW_AES192;
+            this.asymmetricKeyWrap = Constants.KW_RSA15;
+            this.encryptionKeyDerivation = Constants.P_SHA1_L192;
+            this.signatureKeyDerivation = Constants.P_SHA1_L192;
+            this.minimumSymmetricKeyLength = 192;
+        } else if (Constants.ALGO_SUITE_BASIC128_RSA15.equals(algoSuite)) {
+            this.digest = Constants.SHA1;
+            this.encryption = Constants.AES128;
+            this.symmetricKeyWrap = Constants.KW_AES128;
+            this.asymmetricKeyWrap = Constants.KW_RSA15;
+            this.encryptionKeyDerivation = Constants.P_SHA1_L128;
+            this.signatureKeyDerivation = Constants.P_SHA1_L128;
+            this.minimumSymmetricKeyLength = 128;
+        } else if (Constants.ALGO_SUITE_TRIPLE_DES_RSA15.equals(algoSuite)) {
+            this.digest = Constants.SHA1;
+            this.encryption = Constants.TRIPLE_DES;
+            this.symmetricKeyWrap = Constants.KW_TRIPLE_DES;
+            this.asymmetricKeyWrap = Constants.KW_RSA15;
+            this.encryptionKeyDerivation = Constants.P_SHA1_L192;
+            this.signatureKeyDerivation = Constants.P_SHA1_L192;
+            this.minimumSymmetricKeyLength = 192;
+        } else if(Constants.ALGO_SUITE_BASIC256_SHA256.equals(algoSuite)) {
+            this.digest = Constants.SHA256;
+            this.encryption = Constants.AES256;
+            this.symmetricKeyWrap = Constants.KW_AES256;
+            this.asymmetricKeyWrap = Constants.KW_RSA_OAEP;
+            this.encryptionKeyDerivation = Constants.P_SHA1_L256;
+            this.signatureKeyDerivation = Constants.P_SHA1_L192;
+            this.minimumSymmetricKeyLength = 256;
+        } else if (Constants.ALGO_SUITE_BASIC192_SHA256.equals(algoSuite)) {
+            this.digest = Constants.SHA256;
+            this.encryption = Constants.AES192;
+            this.symmetricKeyWrap = Constants.KW_AES192;
+            this.asymmetricKeyWrap = Constants.KW_RSA_OAEP;
+            this.encryptionKeyDerivation = Constants.P_SHA1_L192;
+            this.signatureKeyDerivation = Constants.P_SHA1_L192;
+            this.minimumSymmetricKeyLength = 192;
+        } else if (Constants.ALGO_SUITE_BASIC128_SHA256.equals(algoSuite)) {
+            this.digest = Constants.SHA256;
+            this.encryption = Constants.AES128;
+            this.symmetricKeyWrap = Constants.KW_AES128;
+            this.asymmetricKeyWrap = Constants.KW_RSA_OAEP;
+            this.encryptionKeyDerivation = Constants.P_SHA1_L128;
+            this.signatureKeyDerivation = Constants.P_SHA1_L128;
+            this.minimumSymmetricKeyLength = 128;
+        } else if(Constants.ALGO_SUITE_TRIPLE_DES_SHA256.equals(algoSuite)) {
+            this.digest = Constants.SHA256;
+            this.encryption = Constants.TRIPLE_DES;
+            this.symmetricKeyWrap = Constants.KW_TRIPLE_DES;
+            this.asymmetricKeyWrap = Constants.KW_RSA_OAEP;
+            this.encryptionKeyDerivation = Constants.P_SHA1_L192;
+            this.signatureKeyDerivation = Constants.P_SHA1_L192;
+            this.minimumSymmetricKeyLength = 192;
+        }  else if (Constants.ALGO_SUITE_BASIC256_SHA256_RSA15.equals(algoSuite)) {
+            this.digest = Constants.SHA256;
+            this.encryption = Constants.AES256;
+            this.symmetricKeyWrap = Constants.KW_AES256;
+            this.asymmetricKeyWrap = Constants.KW_RSA15;
+            this.encryptionKeyDerivation = Constants.P_SHA1_L256;
+            this.signatureKeyDerivation = Constants.P_SHA1_L192;
+            this.minimumSymmetricKeyLength = 256;
+        } else if (Constants.ALGO_SUITE_BASIC192_SHA256_RSA15.equals(algoSuite)) {
+            this.digest = Constants.SHA256;
+            this.encryption = Constants.AES192;
+            this.symmetricKeyWrap = Constants.KW_AES192;
+            this.asymmetricKeyWrap = Constants.KW_RSA15;
+            this.encryptionKeyDerivation = Constants.P_SHA1_L192;
+            this.signatureKeyDerivation = Constants.P_SHA1_L192;
+            this.minimumSymmetricKeyLength = 192;
+        } else if (Constants.ALGO_SUITE_BASIC128_SHA256_RSA15.equals(algoSuite)) {
+            this.digest = Constants.SHA256;
+            this.encryption = Constants.AES128;
+            this.symmetricKeyWrap = Constants.KW_AES128;
+            this.asymmetricKeyWrap = Constants.KW_RSA15;
+            this.encryptionKeyDerivation = Constants.P_SHA1_L128;
+            this.signatureKeyDerivation = Constants.P_SHA1_L128;
+            this.minimumSymmetricKeyLength = 128;
+        } else if (Constants.ALGO_SUITE_TRIPLE_DES_SHA256_RSA15.equals(algoSuite)) {
+            this.digest = Constants.SHA256;
+            this.encryption = Constants.TRIPLE_DES;
+            this.symmetricKeyWrap = Constants.KW_TRIPLE_DES;
+            this.asymmetricKeyWrap = Constants.KW_RSA15;
+            this.encryptionKeyDerivation = Constants.P_SHA1_L192;
+            this.signatureKeyDerivation = Constants.P_SHA1_L192;
+            this.minimumSymmetricKeyLength = 192;
+        } else {
+            throw new WSSPolicyException("Invalid algorithm suite : " + algoSuite);
+        }
+    }
+
+    /**
+     * @return Returns the asymmetricKeyWrap.
+     */
+    public String getAsymmetricKeyWrap() {
+        return asymmetricKeyWrap;
+    }
+
+    /**
+     * @return Returns the asymmetricSignature.
+     */
+    public String getAsymmetricSignature() {
+        return asymmetricSignature;
+    }
+
+    /**
+     * @return Returns the computedKey.
+     */
+    public String getComputedKey() {
+        return computedKey;
+    }
+
+    /**
+     * @return Returns the digest.
+     */
+    public String getDigest() {
+        return digest;
+    }
+
+    /**
+     * @return Returns the encryption.
+     */
+    public String getEncryption() {
+        return encryption;
+    }
+
+    /**
+     * @return Returns the encryptionKeyDerivation.
+     */
+    public String getEncryptionKeyDerivation() {
+        return encryptionKeyDerivation;
+    }
+
+    /**
+     * @return Returns the maximumAsymmetricKeyLength.
+     */
+    public int getMaximumAsymmetricKeyLength() {
+        return maximumAsymmetricKeyLength;
+    }
+
+    /**
+     * @return Returns the maximumSymmetricKeyLength.
+     */
+    public int getMaximumSymmetricKeyLength() {
+        return maximumSymmetricKeyLength;
+    }
+
+    /**
+     * @return Returns the minimumAsymmetricKeyLength.
+     */
+    public int getMinimumAsymmetricKeyLength() {
+        return minimumAsymmetricKeyLength;
+    }
+
+    /**
+     * @return Returns the minimumSymmetricKeyLength.
+     */
+    public int getMinimumSymmetricKeyLength() {
+        return minimumSymmetricKeyLength;
+    }
+
+    /**
+     * @return Returns the signatureKeyDerivation.
+     */
+    public String getSignatureKeyDerivation() {
+        return signatureKeyDerivation;
+    }
+
+    /**
+     * @return Returns the symmetricKeyWrap.
+     */
+    public String getSymmetricKeyWrap() {
+        return symmetricKeyWrap;
+    }
+
+    /**
+     * @return Returns the symmetricSignature.
+     */
+    public String getSymmetricSignature() {
+        return symmetricSignature;
+    }
+
+    /**
+     * @return Returns the c14n.
+     */
+    public String getInclusiveC14n() {
+        return c14n;
+    }
+
+    /**
+     * @param c14n The c14n to set.
+     */
+    public void setC14n(String c14n) throws WSSPolicyException {
+            this.c14n = c14n;
+    }
+
+    /**
+     * @return Returns the soapNormalization.
+     */
+    public String getSoapNormalization() {
+        return soapNormalization;
+    }
+
+    /**
+     * @param soapNormalization The soapNormalization to set.
+     */
+    public void setSoapNormalization(String soapNormalization) throws WSSPolicyException {
+            this.soapNormalization = soapNormalization;
+    }
+
+    /**
+     * @return Returns the strTransform.
+     */
+    public String getStrTransform() {
+        return strTransform;
+    }
+
+    /**
+     * @param strTransform The strTransform to set.
+     */
+    public void setStrTransform(String strTransform) throws WSSPolicyException {
+            this.strTransform = strTransform;
+    }
+
+    /**
+     * @return Returns the xPath.
+     */
+    public String getXPath() {
+        return xPath;
+    }
+
+    /**
+     * @param path The xPath to set.
+     */
+    public void setXPath(String path) throws WSSPolicyException{
+        xPath = path;
+    }
+    
+}

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/AlgorithmWrapper.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/AlgorithmWrapper.java?rev=371870&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/AlgorithmWrapper.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/AlgorithmWrapper.java Tue Jan 24 01:13:40 2006
@@ -0,0 +1,25 @@
+/*
+ * 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.security.policy.model;
+
+import org.apache.ws.security.policy.WSSPolicyException;
+
+public interface AlgorithmWrapper {
+
+    public void setAlgorithmSuite(AlgorithmSuite algorithmSuite) throws WSSPolicyException;
+    
+}

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/AsymmetricBinding.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/AsymmetricBinding.java?rev=371870&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/AsymmetricBinding.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/AsymmetricBinding.java Tue Jan 24 01:13:40 2006
@@ -0,0 +1,51 @@
+/*
+ * 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.security.policy.model;
+
+public class AsymmetricBinding extends SymmetricAsymmetricBindingBase {
+    
+    private InitiatorToken initiatorToken;
+    
+    private RecipientToken recipientToken;
+    
+    /**
+     * @return Returns the initiatorToken.
+     */
+    public InitiatorToken getInitiatorToken() {
+        return initiatorToken;
+    }
+    /**
+     * @param initiatorToken The initiatorToken to set.
+     */
+    public void setInitiatorToken(InitiatorToken initiatorToken) {
+        this.initiatorToken = initiatorToken;
+    }
+    /**
+     * @return Returns the recipientToken.
+     */
+    public RecipientToken getRecipientToken() {
+        return recipientToken;
+    }
+    /**
+     * @param recipientToken The recipientToken to set.
+     */
+    public void setRecipientToken(RecipientToken recipientToken) {
+        this.recipientToken = recipientToken;
+    }
+    
+    
+}

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/Binding.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/Binding.java?rev=371870&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/Binding.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/Binding.java Tue Jan 24 01:13:40 2006
@@ -0,0 +1,68 @@
+/*
+ * 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.security.policy.model;
+
+import org.apache.ws.security.policy.WSSPolicyException;
+
+public class Binding extends PolicyEngineData implements AlgorithmWrapper {
+
+    private AlgorithmSuite algorithmSuite;
+    private boolean includeTimestamp;
+    private Layout layout = new Layout();
+    
+    /**
+     * @return Returns the algorithmSuite.
+     */
+    public AlgorithmSuite getAlgorithmSuite() {
+        return algorithmSuite;
+    }
+
+    /**
+     * @param algorithmSuite The algorithmSuite to set.
+     */
+    public void setAlgorithmSuite(AlgorithmSuite algorithmSuite) {
+        this.algorithmSuite = algorithmSuite;
+    }
+
+    /**
+     * @return Returns the includeTimestamp.
+     */
+    public boolean isIncludeTimestamp() {
+        return includeTimestamp;
+    }
+
+    /**
+     * @param includeTimestamp The includeTimestamp to set.
+     */
+    public void setIncludeTimestamp(boolean includeTimestamp) {
+        this.includeTimestamp = includeTimestamp;
+    }
+    
+    /**
+     * @return Returns the layout.
+     */
+    public Layout getLayout() {
+        return layout;
+    }
+
+    /**
+     * @param layout The layout to set.
+     */
+    public void setLayout(Layout layout) throws WSSPolicyException {
+        this.layout = layout;
+    }
+}

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/EncryptionToken.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/EncryptionToken.java?rev=371870&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/EncryptionToken.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/EncryptionToken.java Tue Jan 24 01:13:40 2006
@@ -0,0 +1,46 @@
+/*
+ * 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.security.policy.model;
+
+import org.apache.ws.security.policy.WSSPolicyException;
+
+public class EncryptionToken extends PolicyEngineData implements TokenWrapper {
+
+    private Token encryptionToken;
+
+    /**
+     * @return Returns the encryptionToken.
+     */
+    public Token getEncryptionToken() {
+        return encryptionToken;
+    }
+
+    /**
+     * @param encryptionToken The encryptionToken to set.
+     */
+    public void setEncryptionToken(Token encryptionToken) {
+        this.encryptionToken = encryptionToken;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.ws.security.policy.TokenWrapper#setToken(org.apache.ws.security.policy.Token)
+     */
+    public void setToken(Token tok) throws WSSPolicyException {
+        this.setEncryptionToken(tok);
+    }
+    
+}

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/Header.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/Header.java?rev=371870&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/Header.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/Header.java Tue Jan 24 01:13:40 2006
@@ -0,0 +1,49 @@
+/*
+ * 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.security.policy.model;
+
+public class Header extends PolicyEngineData {
+
+    private String name;
+    private String namespace;
+    
+    /**
+     * @return Returns the name.
+     */
+    public String getName() {
+        return name;
+    }
+    /**
+     * @param name The name to set.
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+    /**
+     * @return Returns the namespace.
+     */
+    public String getNamespace() {
+        return namespace;
+    }
+    /**
+     * @param namespace The namespace to set.
+     */
+    public void setNamespace(String namespace) {
+        this.namespace = namespace;
+    }
+    
+}

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/InitiatorToken.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/InitiatorToken.java?rev=371870&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/InitiatorToken.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/InitiatorToken.java Tue Jan 24 01:13:40 2006
@@ -0,0 +1,47 @@
+/*
+ * 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.security.policy.model;
+
+import org.apache.ws.security.policy.WSSPolicyException;
+
+public class InitiatorToken extends PolicyEngineData implements TokenWrapper {
+    
+    private Token initiatorToken;
+
+    /**
+     * @return Returns the initiatorToken.
+     */
+    public Token getInitiatorToken() {
+        return initiatorToken;
+    }
+
+    /**
+     * @param initiatorToken The initiatorToken to set.
+     */
+    public void setInitiatorToken(Token initiatorToken) {
+        this.initiatorToken = initiatorToken;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.ws.security.policy.TokenWrapper#setToken(org.apache.ws.security.policy.Token)
+     */
+    public void setToken(Token tok) throws WSSPolicyException {
+        this.setInitiatorToken(tok);
+    }
+    
+    
+}

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/Layout.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/Layout.java?rev=371870&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/Layout.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/Layout.java Tue Jan 24 01:13:40 2006
@@ -0,0 +1,48 @@
+/*
+ * 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.security.policy.model;
+
+import org.apache.ws.security.policy.Constants;
+import org.apache.ws.security.policy.WSSPolicyException;
+
+public class Layout extends PolicyEngineData {
+   
+    private String value = Constants.LAYOUT_LAX;
+
+    /**
+     * @return Returns the value.
+     */
+    public String getValue() {
+        return value;
+    }
+
+    /**
+     * @param value The value to set.
+     */
+    public void setValue(String value) throws WSSPolicyException{
+        if(Constants.LAYOUT_LAX.equals(value) ||
+                Constants.LAYOUT_STRICT.equals(value) ||
+                Constants.LAYOUT_LAX_TIMESTAMP_FIRST.equals(value) ||
+                Constants.LAYOUT_LAX_TIMESTAMP_LAST.equals(value)) {
+                 this.value = value;
+             } else {
+                 throw new WSSPolicyException("Incorrect layout value : " + value);
+             }
+    }
+    
+    
+}

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/PolicyEngineData.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/PolicyEngineData.java?rev=371870&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/PolicyEngineData.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/PolicyEngineData.java Tue Jan 24 01:13:40 2006
@@ -0,0 +1,87 @@
+/*
+ * 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.security.policy.model;
+
+import javax.xml.namespace.QName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.security.policy.Constants;
+import org.apache.ws.security.policy.WSSPolicyException;
+import org.apache.ws.security.policy.parser.SecurityPolicy;
+
+public class PolicyEngineData {
+
+    private static Log log = LogFactory.getLog(PolicyEngineData.class);
+    
+    public void initializeWithDefaults() {
+        
+    }
+    
+    public static  PolicyEngineData copy(QName name) throws WSSPolicyException {
+        if(name.getLocalPart().equals(SecurityPolicy.symmetricBinding.getTokenName())) {
+            return new SymmetricBinding();
+        } else if (name.getLocalPart().equals(SecurityPolicy.asymmetricBinding.getTokenName())) {
+            return new AsymmetricBinding();
+        } else if (name.getLocalPart().equals(SecurityPolicy.transportBinding.getTokenName())) {
+            return new TransportBinding();
+        } else if (name.getLocalPart().equals(SecurityPolicy.algorithmSuite.getTokenName())) {
+            return new AlgorithmSuite();
+        } else if (name.getLocalPart().equals(SecurityPolicy.signedElements.getTokenName())) {
+            return new SignedEncryptedElements(true);
+        } else if (name.getLocalPart().equals(SecurityPolicy.encryptedElements.getTokenName())) {
+            return new SignedEncryptedElements(false);
+        } else if (name.getLocalPart().equals(SecurityPolicy.signedParts.getTokenName())) {
+            return new SignedEncryptedParts(true);
+        } else if (name.getLocalPart().equals(SecurityPolicy.encryptedParts.getTokenName())) {
+            return new SignedEncryptedParts(false);
+        } else if (name.getLocalPart().equals(SecurityPolicy.header.getTokenName())) {
+            return new Header();
+        } else if (name.getLocalPart().equals(SecurityPolicy.protectionToken.getTokenName())) {
+            return new ProtectionToken();
+        } else if (name.getLocalPart().equals(SecurityPolicy.signatureToken.getTokenName())) {
+            return new SignatureToken();
+        } else if (name.getLocalPart().equals(SecurityPolicy.encryptionToken.getTokenName())) {
+            return new EncryptionToken();
+        } else if (name.getLocalPart().equals(SecurityPolicy.x509Token.getTokenName())) {
+            return new X509Token();
+        } else if (name.getLocalPart().equals(SecurityPolicy.layout.getTokenName())) {
+            return new Layout();
+        } else if (name.getLocalPart().equals(SecurityPolicy.signedSupportingTokens.getTokenName())) {
+            return new SupportingToken(Constants.SUPPORTING_TOKEN_SIGNED);
+        } else if (name.getLocalPart().equals(SecurityPolicy.signedEndorsingSupportingTokens.getTokenName())) {
+            return new SupportingToken(Constants.SUPPORTING_TOKEN_SIGNED_ENDORSING);
+        } else if (name.getLocalPart().equals(SecurityPolicy.supportingTokens.getTokenName())) {
+            return new SupportingToken(Constants.SUPPORTING_TOKEN_SUPPORTING);
+        } else if (name.getLocalPart().equals(SecurityPolicy.endorsingSupportingTokens.getTokenName())) {
+            return new SupportingToken(Constants.SUPPORTING_TOKEN_ENDORSING);
+        } else if (name.getLocalPart().equals(SecurityPolicy.usernameToken.getTokenName())) {
+            return new UsernameToken();
+        } else if (name.getLocalPart().equals(SecurityPolicy.wss10.getTokenName())) {
+            return new Wss10();
+        } else if (name.getLocalPart().equals(SecurityPolicy.wss11.getTokenName())) {
+            return new Wss11();
+        } else if (name.getLocalPart().equals(SecurityPolicy.initiatorToken.getTokenName())) {
+            return new InitiatorToken();
+        } else if (name.getLocalPart().equals(SecurityPolicy.recipientToken.getTokenName())) {
+            return new RecipientToken();
+        } else {
+            log.error("Unsuppotred: " + name.getLocalPart());
+            throw new WSSPolicyException("Unsuppotred complex assertion :" + name.getLocalPart());
+        }
+    }
+}

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/ProtectionToken.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/ProtectionToken.java?rev=371870&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/ProtectionToken.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/ProtectionToken.java Tue Jan 24 01:13:40 2006
@@ -0,0 +1,44 @@
+/*
+ * 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.security.policy.model;
+
+import org.apache.ws.security.policy.WSSPolicyException;
+
+public class ProtectionToken extends PolicyEngineData implements TokenWrapper {
+    
+    private Token protectionToken;
+
+    /**
+     * @return Returns the protectionToken.
+     */
+    public Token getProtectionToken() {
+        return protectionToken;
+    }
+
+    /**
+     * @param protectionToken The protectionToken to set.
+     */
+    public void setProtectionToken(Token protectionToken) {
+        this.protectionToken = protectionToken;
+    }
+
+    public void setToken(Token tok) throws WSSPolicyException {
+        this.setProtectionToken(tok);
+    }
+    
+    
+}

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/RecipientToken.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/RecipientToken.java?rev=371870&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/RecipientToken.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/RecipientToken.java Tue Jan 24 01:13:40 2006
@@ -0,0 +1,47 @@
+/*
+ * 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.security.policy.model;
+
+import org.apache.ws.security.policy.WSSPolicyException;
+
+public class RecipientToken extends PolicyEngineData implements TokenWrapper {
+    
+    private Token receipientToken;
+
+    /**
+     * @return Returns the receipientToken.
+     */
+    public Token getReceipientToken() {
+        return receipientToken;
+    }
+
+    /**
+     * @param receipientToken The receipientToken to set.
+     */
+    public void setReceipientToken(Token receipientToken) {
+        this.receipientToken = receipientToken;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.ws.security.policy.TokenWrapper#setToken(org.apache.ws.security.policy.Token)
+     */
+    public void setToken(Token tok) throws WSSPolicyException {
+        this.setReceipientToken(tok);
+    }
+    
+    
+}

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/RootPolicyEngineData.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/RootPolicyEngineData.java?rev=371870&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/RootPolicyEngineData.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/RootPolicyEngineData.java Tue Jan 24 01:13:40 2006
@@ -0,0 +1,34 @@
+/*
+ * 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.security.policy.model;
+
+import java.util.ArrayList;
+
+public class RootPolicyEngineData extends PolicyEngineData {
+
+    private ArrayList topLevelPEDs = new ArrayList();
+    
+    public void addTopLevelPED(PolicyEngineData ped) {
+        if(!topLevelPEDs.contains(ped)) {
+            this.topLevelPEDs.add(ped);
+        }
+    }
+    
+    public ArrayList getTopLevelPEDs() {
+        return this.topLevelPEDs;
+    }
+}

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/SignatureToken.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/SignatureToken.java?rev=371870&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/SignatureToken.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/SignatureToken.java Tue Jan 24 01:13:40 2006
@@ -0,0 +1,47 @@
+/*
+ * 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.security.policy.model;
+
+import org.apache.ws.security.policy.WSSPolicyException;
+
+public class SignatureToken extends PolicyEngineData implements TokenWrapper {
+
+    private Token signatureToken;
+
+    /**
+     * @return Returns the signatureToken.
+     */
+    public Token getSignatureToken() {
+        return signatureToken;
+    }
+
+    /**
+     * @param signatureToken The signatureToken to set.
+     */
+    public void setSignatureToken(Token signatureToken) {
+        this.signatureToken = signatureToken;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.ws.security.policy.TokenWrapper#setToken(org.apache.ws.security.policy.Token)
+     */
+    public void setToken(Token tok) throws WSSPolicyException {
+        this.setSignatureToken(tok);
+    }
+    
+    
+}

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/SignedEncryptedElements.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/SignedEncryptedElements.java?rev=371870&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/SignedEncryptedElements.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/SignedEncryptedElements.java Tue Jan 24 01:13:40 2006
@@ -0,0 +1,70 @@
+/*
+ * 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.security.policy.model;
+
+import java.util.ArrayList;
+
+public class SignedEncryptedElements extends PolicyEngineData {
+
+    private ArrayList xPathExpressions = new ArrayList();
+    private String xPathVersion;
+    
+    /**
+     * Just a flag to identify whether this holds 
+     * sign element info or encr elements info 
+     */
+    private boolean signedElemets;
+    
+    public SignedEncryptedElements(boolean signedElements) {
+        this.signedElemets = signedElements;
+    }
+    
+    /**
+     * @return Returns the xPathExpressions.
+     */
+    public ArrayList getXPathExpressions() {
+        return xPathExpressions;
+    }
+
+    public void addXPathExpression(String expr) {
+        this.xPathExpressions.add(expr);
+    }
+
+    /**
+     * @return Returns the xPathVersion.
+     */
+    public String getXPathVersion() {
+        return xPathVersion;
+    }
+
+    /**
+     * @param pathVersion The xPathVersion to set.
+     */
+    public void setXPathVersion(String pathVersion) {
+        xPathVersion = pathVersion;
+    }
+
+    /**
+     * @return Returns the signedElemets.
+     */
+    public boolean isSignedElemets() {
+        return signedElemets;
+    }
+    
+    
+    
+}

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/SignedEncryptedParts.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/SignedEncryptedParts.java?rev=371870&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/SignedEncryptedParts.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/SignedEncryptedParts.java Tue Jan 24 01:13:40 2006
@@ -0,0 +1,70 @@
+/*
+ * 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.security.policy.model;
+
+import java.util.ArrayList;
+
+public class SignedEncryptedParts extends PolicyEngineData {
+
+    private boolean body;
+    
+    private ArrayList headers = new ArrayList();
+    
+    private boolean signedParts;
+    
+    public SignedEncryptedParts(boolean signedParts) {
+        this.signedParts = signedParts;
+    }
+
+    /**
+     * @return Returns the body.
+     */
+    public boolean isBody() {
+        return body;
+    }
+
+    /**
+     * @param body The body to set.
+     */
+    public void setBody(boolean body) {
+        this.body = body;
+    }
+
+    /**
+     * @return Returns the headers.
+     */
+    public ArrayList getHeaders() {
+        return this.headers;
+    }
+
+    /**
+     * @param headers The headers to set.
+     */
+    public void addHeader(Header header) {
+        this.headers.add(header);
+    }
+
+    /**
+     * @return Returns the signedParts.
+     */
+    public boolean isSignedParts() {
+        return signedParts;
+    }
+    
+    
+    
+}

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/SupportingToken.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/SupportingToken.java?rev=371870&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/SupportingToken.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/SupportingToken.java Tue Jan 24 01:13:40 2006
@@ -0,0 +1,157 @@
+/*
+ * 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.security.policy.model;
+
+import java.util.ArrayList;
+
+import org.apache.ws.security.policy.WSSPolicyException;
+
+public class SupportingToken extends PolicyEngineData implements AlgorithmWrapper, TokenWrapper {
+
+    /**
+     * Type of SupportingToken
+     * @see SupportingToken#SUPPORTING
+     * @see SupportingToken#ENDORSING
+     * @see SupportingToken#SIGNED
+     * @see SupportingToken#SIGNED_ENDORSING
+     */
+    private int type;
+    
+    private AlgorithmSuite algorithmSuite;
+    
+    private ArrayList tokens = new ArrayList();
+    
+    private SignedEncryptedElements signedElements;
+    
+    private SignedEncryptedElements encryptedElements;
+    
+    private SignedEncryptedParts signedParts;
+    
+    private SignedEncryptedParts encryptedParts;
+    
+    public SupportingToken(int type) {
+        this.type = type;
+    }
+
+    /**
+     * @return Returns the algorithmSuite.
+     */
+    public AlgorithmSuite getAlgorithmSuite() {
+        return algorithmSuite;
+    }
+
+    /**
+     * @param algorithmSuite The algorithmSuite to set.
+     */
+    public void setAlgorithmSuite(AlgorithmSuite algorithmSuite) {
+        this.algorithmSuite = algorithmSuite;
+    }
+
+    /**
+     * @return Returns the token.
+     */
+    public ArrayList getToken() {
+        return tokens;
+    }
+
+    /**
+     * @param token The token to set.
+     */
+    public void addToken(Token token) {
+        this.tokens.add(token);
+    }
+
+    /**
+     * @return Returns the type.
+     */
+    public int getType() {
+        return type;
+    }
+
+    /**
+     * @param type The type to set.
+     */
+    public void setType(int type) {
+        this.type = type;
+    }
+
+    /**
+     * @return Returns the encryptedElements.
+     */
+    public SignedEncryptedElements getEncryptedElements() {
+        return encryptedElements;
+    }
+
+    /**
+     * @param encryptedElements The encryptedElements to set.
+     */
+    public void setEncryptedElements(SignedEncryptedElements encryptedElements) {
+        this.encryptedElements = encryptedElements;
+    }
+
+    /**
+     * @return Returns the encryptedParts.
+     */
+    public SignedEncryptedParts getEncryptedParts() {
+        return encryptedParts;
+    }
+
+    /**
+     * @param encryptedParts The encryptedParts to set.
+     */
+    public void setEncryptedParts(SignedEncryptedParts encryptedParts) {
+        this.encryptedParts = encryptedParts;
+    }
+
+    /**
+     * @return Returns the signedElements.
+     */
+    public SignedEncryptedElements getSignedElements() {
+        return signedElements;
+    }
+
+    /**
+     * @param signedElements The signedElements to set.
+     */
+    public void setSignedElements(SignedEncryptedElements signedElements) {
+        this.signedElements = signedElements;
+    }
+
+    /**
+     * @return Returns the signedParts.
+     */
+    public SignedEncryptedParts getSignedParts() {
+        return signedParts;
+    }
+
+    /**
+     * @param signedParts The signedParts to set.
+     */
+    public void setSignedParts(SignedEncryptedParts signedParts) {
+        this.signedParts = signedParts;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.ws.security.policy.TokenWrapper#setToken(org.apache.ws.security.policy.Token)
+     */
+    public void setToken(Token tok) throws WSSPolicyException {
+        this.addToken(tok);
+    }
+    
+    
+    
+}

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/SymmetricAsymmetricBindingBase.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/SymmetricAsymmetricBindingBase.java?rev=371870&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/SymmetricAsymmetricBindingBase.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/SymmetricAsymmetricBindingBase.java Tue Jan 24 01:13:40 2006
@@ -0,0 +1,98 @@
+/*
+ * 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.security.policy.model;
+
+import org.apache.ws.security.policy.Constants;
+import org.apache.ws.security.policy.WSSPolicyException;
+
+class SymmetricAsymmetricBindingBase extends Binding {
+
+    private String protectionOrder = Constants.SIGN_BEFORE_ENCRYPTING;
+    
+    private boolean signatureProtection;
+    
+    private boolean tokenProtection;
+    
+    private boolean entireHeaderAndBodySignatures;
+
+    /**
+     * @return Returns the entireHeaderAndBodySignatures.
+     */
+    public boolean isEntireHeaderAndBodySignatures() {
+        return entireHeaderAndBodySignatures;
+    }
+
+    /**
+     * @param entireHeaderAndBodySignatures The entireHeaderAndBodySignatures to set.
+     */
+    public void setEntireHeaderAndBodySignatures(
+            boolean entireHeaderAndBodySignatures) {
+        this.entireHeaderAndBodySignatures = entireHeaderAndBodySignatures;
+    }
+
+    /**
+     * @return Returns the protectionOrder.
+     */
+    public String getProtectionOrder() {
+        return protectionOrder;
+    }
+
+    /**
+     * @param protectionOrder The protectionOrder to set.
+     */
+    public void setProtectionOrder(String protectionOrder)
+            throws WSSPolicyException {
+        if(Constants.ENCRYPT_BEFORE_SIGNING.equals(protectionOrder) ||
+           Constants.SIGN_BEFORE_ENCRYPTING.equals(protectionOrder)) {
+            this.protectionOrder = protectionOrder;
+        } else {
+            throw new WSSPolicyException("Incorrect protection order value : "
+                    + protectionOrder);
+        }
+    }
+
+    /**
+     * @return Returns the signatureProtection.
+     */
+    public boolean isSignatureProtection() {
+        return signatureProtection;
+    }
+
+    /**
+     * @param signatureProtection The signatureProtection to set.
+     */
+    public void setSignatureProtection(boolean signatureProtection) {
+        this.signatureProtection = signatureProtection;
+    }
+
+    /**
+     * @return Returns the tokenProtection.
+     */
+    public boolean isTokenProtection() {
+        return tokenProtection;
+    }
+
+    /**
+     * @param tokenProtection The tokenProtection to set.
+     */
+    public void setTokenProtection(boolean tokenProtection) {
+        this.tokenProtection = tokenProtection;
+    }
+    
+    
+    
+}

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/SymmetricBinding.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/SymmetricBinding.java?rev=371870&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/SymmetricBinding.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/SymmetricBinding.java Tue Jan 24 01:13:40 2006
@@ -0,0 +1,85 @@
+/*
+ * 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.security.policy.model;
+
+import org.apache.ws.security.policy.WSSPolicyException;
+
+public class SymmetricBinding extends SymmetricAsymmetricBindingBase {
+
+    private EncryptionToken encryptionToken;
+    
+    private SignatureToken signatureToken;
+    
+    private ProtectionToken protectionToken;
+
+    /**
+     * @return Returns the encryptionToken.
+     */
+    public EncryptionToken getEncryptionToken() {
+        return encryptionToken;
+    }
+
+    /**
+     * @param encryptionToken The encryptionToken to set.
+     */
+    public void setEncryptionToken(EncryptionToken encryptionToken) throws WSSPolicyException {
+        if(this.protectionToken != null) {
+            throw new WSSPolicyException("Cannot use an EncryptionToken in a " +
+                    "SymmetricBinding when there is a ProtectionToken");
+        }
+        this.encryptionToken = encryptionToken;
+    }
+
+    /**
+     * @return Returns the protectionToken.
+     */
+    public ProtectionToken getProtectionToken() {
+        return protectionToken;
+    }
+
+    /**
+     * @param protectionToken The protectionToken to set.
+     */
+    public void setProtectionToken(ProtectionToken protectionToken) throws WSSPolicyException {
+        if(this.encryptionToken != null || this.signatureToken != null) {
+            throw new WSSPolicyException("Cannot use a ProtectionToken in a " +
+            "SymmetricBinding when there is a SignatureToken or an" +
+            "EncryptionToken");
+        }
+        this.protectionToken = protectionToken;
+    }
+
+    /**
+     * @return Returns the signatureToken.
+     */
+    public SignatureToken getSignatureToken() {
+        return signatureToken;
+    }
+
+    /**
+     * @param signatureToken The signatureToken to set.
+     */
+    public void setSignatureToken(SignatureToken signatureToken) throws WSSPolicyException {
+        if(this.protectionToken != null) {
+            throw new WSSPolicyException("Cannot use a SignatureToken in a " +
+                    "SymmetricBinding when there is a ProtectionToken");
+        }
+        this.signatureToken = signatureToken;
+    }
+    
+    
+}

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/Token.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/Token.java?rev=371870&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/Token.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/Token.java Tue Jan 24 01:13:40 2006
@@ -0,0 +1,69 @@
+/*
+ * 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.security.policy.model;
+
+import org.apache.ws.security.policy.Constants;
+import org.apache.ws.security.policy.WSSPolicyException;
+
+class Token extends PolicyEngineData {
+
+    /**
+     * Inclusiong property of a TokenAssertion
+     */
+    private String inclusion = Constants.INCLUDE_ALWAYS;
+    
+    /**
+     * Whether to derive keys or not
+     */
+    private boolean derivedKeys;
+    
+    /**
+     * @return Returns the inclusion.
+     */
+    public String getInclusion() {
+        return inclusion;
+    }
+
+    /**
+     * @param inclusion The inclusion to set.
+     */
+    public void setInclusion(String inclusion) throws WSSPolicyException {
+        if(Constants.INCLUDE_ALWAYS.equals(inclusion) || 
+           Constants.INCLUDE_ALWAYS_TO_RECIPIENT.equals(inclusion) ||
+           Constants.INCLUDE_NEVER.equals(inclusion) ||
+           Constants.INCLUDE_ONCE.equals(inclusion)) {
+            this.inclusion = inclusion;
+        } else {
+            throw new WSSPolicyException("Incorrect inclusion value: " + inclusion);
+        }
+    }
+    
+    /**
+     * @return Returns the derivedKeys.
+     */
+    public boolean isDerivedKeys() {
+        return derivedKeys;
+    }
+
+    /**
+     * @param derivedKeys The derivedKeys to set.
+     */
+    public void setDerivedKeys(boolean derivedKeys) {
+        this.derivedKeys = derivedKeys;
+    }    
+    
+}
\ No newline at end of file



Mime
View raw message