You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wss4j-dev@ws.apache.org by we...@apache.org on 2006/01/29 16:18:00 UTC

svn commit: r373316 - in /webservices/wss4j/trunk/src/org/apache/ws/security/policy: ./ model/ parser/ parser/processors/

Author: werner
Date: Sun Jan 29 07:17:44 2006
New Revision: 373316

URL: http://svn.apache.org/viewcvs?rev=373316&view=rev
Log:
Enhance Policy parser implementation. Not yet fully implemented.

Added:
    webservices/wss4j/trunk/src/org/apache/ws/security/policy/WSS4JPolicyBuilder.java
    webservices/wss4j/trunk/src/org/apache/ws/security/policy/WSS4JPolicyData.java
Modified:
    webservices/wss4j/trunk/src/org/apache/ws/security/policy/model/SymmetricAsymmetricBindingBase.java
    webservices/wss4j/trunk/src/org/apache/ws/security/policy/model/Token.java
    webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/SecurityPolicy.java
    webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/WSSPolicyProcessor.java
    webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/AlgorithmSuiteProcessor.java
    webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/AsymmetricBindingProcessor.java
    webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/EncryptedPartsElementsProcessor.java
    webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/LayoutProcessor.java
    webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/SignedPartsElementsProcessor.java
    webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/SymmetricBindingProcessor.java
    webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/UsernameTokenProcessor.java
    webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/Wss10Processor.java
    webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/Wss11Processor.java
    webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/X509TokenProcessor.java

Added: webservices/wss4j/trunk/src/org/apache/ws/security/policy/WSS4JPolicyBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/wss4j/trunk/src/org/apache/ws/security/policy/WSS4JPolicyBuilder.java?rev=373316&view=auto
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/policy/WSS4JPolicyBuilder.java (added)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/policy/WSS4JPolicyBuilder.java Sun Jan 29 07:17:44 2006
@@ -0,0 +1,162 @@
+/*
+ * 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.AlgorithmSuite;
+import org.apache.ws.security.policy.model.AsymmetricBinding;
+import org.apache.ws.security.policy.model.Binding;
+import org.apache.ws.security.policy.model.ProtectionToken;
+import org.apache.ws.security.policy.model.EncryptionToken;
+import org.apache.ws.security.policy.model.SignatureToken;
+import org.apache.ws.security.policy.model.PolicyEngineData;
+import org.apache.ws.security.policy.model.SymmetricBinding;
+import org.apache.ws.security.policy.model.AsymmetricBinding;
+import org.apache.ws.security.policy.model.SymmetricAsymmetricBindingBase;
+import org.apache.ws.security.policy.model.SignedEncryptedElements;
+import org.apache.ws.security.policy.model.SignedEncryptedParts;
+import org.apache.ws.security.policy.model.Wss10;
+import org.apache.ws.security.policy.model.Wss11;
+
+public class WSS4JPolicyBuilder {
+
+    /**
+     * Compile the parsed security data into one Policy data block.
+     * 
+     * This methods loops over all top level Policy Engine data, extracts the
+     * parsed parameters and sets them into a single data block. The WSS4J
+     * policy enabled handler takes this data block to control the setup of the
+     * security header.
+     * 
+     * @param topLevelPeds
+     *            The list of the top level Policy Engine data
+     * @return The compile Poilcy data block.
+     * @throws WSSPolicyException
+     */
+    public static WSS4JPolicyData build(ArrayList topLevelPeds)
+            throws WSSPolicyException {
+        Iterator topLevelPEDIterator = topLevelPeds.iterator();
+        WSS4JPolicyData wpd = new WSS4JPolicyData();
+        while (topLevelPEDIterator.hasNext()) {
+            PolicyEngineData ped = (PolicyEngineData) topLevelPEDIterator
+                    .next();
+            if (ped instanceof Binding) {
+                if (ped instanceof SymmetricBinding) {
+                    processSymmetricPolicyBinding((SymmetricBinding) ped, wpd);
+                } else {
+                    processAsymmetricPolicyBinding((AsymmetricBinding) ped, wpd);
+                }
+            } else if (ped instanceof Wss10) {
+                processWSS10((Wss10) ped, wpd);
+            } else if (ped instanceof Wss11) {
+                processWSS11((Wss11) ped, wpd);
+            } else if (ped instanceof SignedEncryptedElements) {
+                processSignedEncryptedElements((SignedEncryptedElements) ped,
+                        wpd);
+            } else if (ped instanceof SignedEncryptedParts) {
+                processSignedEncryptedParts((SignedEncryptedParts) ped, wpd);
+            }
+        }
+        return wpd;
+    }
+
+    private static void processSymmetricPolicyBinding(
+            SymmetricBinding symmBinding, WSS4JPolicyData wpd) {
+        binding(symmBinding, wpd);
+        symmAsymmBinding(symmBinding, wpd);
+        symmetricBinding(symmBinding, wpd);
+    }
+
+    private static void processWSS10(Wss10 wss10, WSS4JPolicyData wpd) {
+        // TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    private static void processAsymmetricPolicyBinding(
+            AsymmetricBinding binding, WSS4JPolicyData wpd) {
+        binding(binding, wpd);
+        symmAsymmBinding(binding, wpd);
+        asymmetricBinding(binding, wpd);
+    }
+
+    private static void processWSS11(Wss11 wss11, WSS4JPolicyData wpd) {
+        if (wss11.isRequireSignatureConfirmation()) {
+        }
+    }
+
+    private static void processSignedEncryptedElements(
+            SignedEncryptedElements see, WSS4JPolicyData wpd) {
+        // TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    private static void processSignedEncryptedParts(SignedEncryptedParts sep,
+            WSS4JPolicyData wpd) {
+        // TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    private static void binding(Binding binding, WSS4JPolicyData wpd) {
+        algorithmSuite(binding.getAlgorithmSuite(), wpd);
+        binding.getLayout();
+        binding.isIncludeTimestamp();
+    }
+
+    private static void symmAsymmBinding(
+            SymmetricAsymmetricBindingBase binding, WSS4JPolicyData wpd) {
+        binding.isEntireHeaderAndBodySignatures();
+        binding.getProtectionOrder();
+        binding.isSignatureProtection();
+        binding.isTokenProtection();
+    }
+
+    private static void symmetricBinding(SymmetricBinding binding,
+            WSS4JPolicyData wpd) {
+        PolicyEngineData ped = binding.getProtectionToken();
+        if (ped != null) {
+            wpd
+                    .setProtectionToken(((ProtectionToken) ped)
+                            .getProtectionToken());
+        } else {
+            ped = binding.getEncryptionToken();
+            PolicyEngineData ped1 = binding.getSignatureToken();
+            if (ped == null && ped1 == null) {
+                // this is an error - throw something
+            }
+            wpd
+                    .setEncryptionToken(((EncryptionToken) ped)
+                            .getEncryptionToken());
+            wpd.setSignatureToken(((SignatureToken) ped).getSignatureToken());
+        }
+    }
+
+    private static void asymmetricBinding(AsymmetricBinding binding,
+            WSS4JPolicyData wpd) {
+        PolicyEngineData ped = binding.getRecipientToken();
+        PolicyEngineData ped1 = binding.getInitiatorToken();
+        if (ped == null && ped1 == null) {
+            // this is an error - throw something
+        }
+        wpd.setRecipientToken(((EncryptionToken) ped).getEncryptionToken());
+        wpd.setInitiatorToken(((SignatureToken) ped).getSignatureToken());
+    }
+
+    private static void algorithmSuite(AlgorithmSuite suite, WSS4JPolicyData wpd) {
+    }
+
+}

Added: webservices/wss4j/trunk/src/org/apache/ws/security/policy/WSS4JPolicyData.java
URL: http://svn.apache.org/viewcvs/webservices/wss4j/trunk/src/org/apache/ws/security/policy/WSS4JPolicyData.java?rev=373316&view=auto
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/policy/WSS4JPolicyData.java (added)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/policy/WSS4JPolicyData.java Sun Jan 29 07:17:44 2006
@@ -0,0 +1,90 @@
+/*
+ * 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.ws.security.policy.model.Token;
+
+public class WSS4JPolicyData {
+
+    private Token protectionToken;
+    private Token encryptionToken;
+    private Token signatureToken;
+    private Token recipientToken;
+    private Token initiatorToken;
+    /**
+     * @return Returns the encryptionToken.
+     */
+    public Token getEncryptionToken() {
+        return encryptionToken;
+    }
+    /**
+     * @param encryptionToken The encryptionToken to set.
+     */
+    public void setEncryptionToken(Token encryptionToken) {
+        this.encryptionToken = encryptionToken;
+    }
+    /**
+     * @return Returns the protectionToken.
+     */
+    public Token getProtectionToken() {
+        return protectionToken;
+    }
+    /**
+     * @param protectionToken The protectionToken to set.
+     */
+    public void setProtectionToken(Token protectionToken) {
+        this.protectionToken = protectionToken;
+    }
+    /**
+     * @return Returns the signatureToken.
+     */
+    public Token getSignatureToken() {
+        return signatureToken;
+    }
+    /**
+     * @param signatureToken The signatureToken to set.
+     */
+    public void setSignatureToken(Token signatureToken) {
+        this.signatureToken = signatureToken;
+    }
+    /**
+     * @return Returns the initiatorToken.
+     */
+    public Token getInitiatorToken() {
+        return initiatorToken;
+    }
+    /**
+     * @param initiatorToken The initiatorToken to set.
+     */
+    public void setInitiatorToken(Token initiatorToken) {
+        this.initiatorToken = initiatorToken;
+    }
+    /**
+     * @return Returns the recipientToken.
+     */
+    public Token getRecipientToken() {
+        return recipientToken;
+    }
+    /**
+     * @param recipientToken The recipientToken to set.
+     */
+    public void setRecipientToken(Token recipientToken) {
+        this.recipientToken = recipientToken;
+    }
+    
+    
+}

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/policy/model/SymmetricAsymmetricBindingBase.java
URL: http://svn.apache.org/viewcvs/webservices/wss4j/trunk/src/org/apache/ws/security/policy/model/SymmetricAsymmetricBindingBase.java?rev=373316&r1=373315&r2=373316&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/policy/model/SymmetricAsymmetricBindingBase.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/policy/model/SymmetricAsymmetricBindingBase.java Sun Jan 29 07:17:44 2006
@@ -19,7 +19,7 @@
 import org.apache.ws.security.policy.Constants;
 import org.apache.ws.security.policy.WSSPolicyException;
 
-class SymmetricAsymmetricBindingBase extends Binding {
+public class SymmetricAsymmetricBindingBase extends Binding {
 
     private String protectionOrder = Constants.SIGN_BEFORE_ENCRYPTING;
     

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/policy/model/Token.java
URL: http://svn.apache.org/viewcvs/webservices/wss4j/trunk/src/org/apache/ws/security/policy/model/Token.java?rev=373316&r1=373315&r2=373316&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/policy/model/Token.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/policy/model/Token.java Sun Jan 29 07:17:44 2006
@@ -19,7 +19,7 @@
 import org.apache.ws.security.policy.Constants;
 import org.apache.ws.security.policy.WSSPolicyException;
 
-class Token extends PolicyEngineData {
+public class Token extends PolicyEngineData {
 
     /**
      * Inclusiong property of a TokenAssertion

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/SecurityPolicy.java
URL: http://svn.apache.org/viewcvs/webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/SecurityPolicy.java?rev=373316&r1=373315&r2=373316&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/SecurityPolicy.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/SecurityPolicy.java Sun Jan 29 07:17:44 2006
@@ -314,7 +314,10 @@
 	public static final SecurityPolicyToken encryptBeforeSigning = new SecurityPolicyToken(
 			"EncryptBeforeSigning", SecurityPolicyToken.SIMPLE_TOKEN, null);
 
-	public static final SecurityPolicyToken encryptSignature = new SecurityPolicyToken(
+    public static final SecurityPolicyToken signBeforeEncrypting = new SecurityPolicyToken(
+            "SignBeforeEncrypting", SecurityPolicyToken.SIMPLE_TOKEN, null);
+
+    public static final SecurityPolicyToken encryptSignature = new SecurityPolicyToken(
 			"EncryptSignature", SecurityPolicyToken.SIMPLE_TOKEN, null);
 
 	public static final SecurityPolicyToken protectTokens = new SecurityPolicyToken(

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/WSSPolicyProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/WSSPolicyProcessor.java?rev=373316&r1=373315&r2=373316&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/WSSPolicyProcessor.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/WSSPolicyProcessor.java Sun Jan 29 07:17:44 2006
@@ -286,7 +286,6 @@
             if(spt.getTokenType() == SecurityPolicyToken.COMPLEX_TOKEN && secProcessorContext.getAction() == SecurityProcessorContext.START) {
                 secProcessorContext.pushPolicyEngineData(PolicyEngineData.copy(pa.getName()));
             }
-            
             if (spt == null) {
                 log.debug("Security token: '" + tokenName
                                 + "' unknown in context of '"
@@ -341,7 +340,6 @@
             if(currentToken.getTokenType() == SecurityPolicyToken.COMPLEX_TOKEN) {
             	secProcessorContext.popPolicyEngineData();
             }
-
         }
     }
 

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/AlgorithmSuiteProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/AlgorithmSuiteProcessor.java?rev=373316&r1=373315&r2=373316&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/AlgorithmSuiteProcessor.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/AlgorithmSuiteProcessor.java Sun Jan 29 07:17:44 2006
@@ -26,378 +26,414 @@
 import org.apache.ws.security.policy.parser.SecurityPolicyToken;
 import org.apache.ws.security.policy.parser.SecurityProcessorContext;
 
-
 /**
  * @author Werner Dittmann (werner@apache.org)
  * 
  */
 public class AlgorithmSuiteProcessor {
-    
+
     private Log log = LogFactory.getLog(getClass());
-    
+
     private boolean initializedAlgorithmSuite = false;
 
-	/**
-	 * Intialize the AlgorithmSuite complex token.
-	 * 
-	 * This method creates a copy of the AlgorithmSuite token and sets the
-	 * handler object to the copy. Then it creates copies of the child tokens
-	 * that are allowed for AlgorithmSuite. These tokens are:
-	 * 
-	 * These copies are also initialized with the handler object and then set as
-	 * child tokens of AlgorithmSuite.
-	 * 
-	 * <p/> The handler object that must contain the methods
-	 * <code>doAlgorithmSuite</code>.
-	 * 
-	 * @param spt
-	 *            The token that will hold the child tokens.
-	 * @throws NoSuchMethodException
-	 */
-
-	private void initializeAlgorithmSuite(SecurityPolicyToken spt)
-			throws NoSuchMethodException {
-
-		SecurityPolicyToken tmpSpt;
-
-		tmpSpt = SecurityPolicy.basic256.copy();
-		tmpSpt.setProcessTokenMethod(this);
-		spt.setChildToken(tmpSpt);
-
-		tmpSpt = SecurityPolicy.basic192.copy();
-		tmpSpt.setProcessTokenMethod(this);
-		spt.setChildToken(tmpSpt);
-
-		tmpSpt = SecurityPolicy.basic128.copy();
-		tmpSpt.setProcessTokenMethod(this);
-		spt.setChildToken(tmpSpt);
-
-		tmpSpt = SecurityPolicy.tripleDes.copy();
-		tmpSpt.setProcessTokenMethod(this);
-		spt.setChildToken(tmpSpt);
-
-		tmpSpt = SecurityPolicy.basic256Rsa15.copy();
-		tmpSpt.setProcessTokenMethod(this);
-		spt.setChildToken(tmpSpt);
-
-		tmpSpt = SecurityPolicy.basic192Rsa15.copy();
-		tmpSpt.setProcessTokenMethod(this);
-		spt.setChildToken(tmpSpt);
-
-		tmpSpt = SecurityPolicy.basic128Rsa15.copy();
-		tmpSpt.setProcessTokenMethod(this);
-		spt.setChildToken(tmpSpt);
-
-		tmpSpt = SecurityPolicy.tripleDesRsa15.copy();
-		tmpSpt.setProcessTokenMethod(this);
-		spt.setChildToken(tmpSpt);
-
-		tmpSpt = SecurityPolicy.basic256Sha256.copy();
-		tmpSpt.setProcessTokenMethod(this);
-		spt.setChildToken(tmpSpt);
-
-		tmpSpt = SecurityPolicy.basic192Sha256.copy();
-		tmpSpt.setProcessTokenMethod(this);
-		spt.setChildToken(tmpSpt);
-
-		tmpSpt = SecurityPolicy.basic128Sha256.copy();
-		tmpSpt.setProcessTokenMethod(this);
-		spt.setChildToken(tmpSpt);
-
-		tmpSpt = SecurityPolicy.tripleDesSha256.copy();
-		tmpSpt.setProcessTokenMethod(this);
-		spt.setChildToken(tmpSpt);
-
-		tmpSpt = SecurityPolicy.basic256Sha256Rsa15.copy();
-		tmpSpt.setProcessTokenMethod(this);
-		spt.setChildToken(tmpSpt);
-
-		tmpSpt = SecurityPolicy.basic192Sha256Rsa15.copy();
-		tmpSpt.setProcessTokenMethod(this);
-		spt.setChildToken(tmpSpt);
-
-		tmpSpt = SecurityPolicy.basic128Sha256Rsa15.copy();
-		tmpSpt.setProcessTokenMethod(this);
-		spt.setChildToken(tmpSpt);
-
-		tmpSpt = SecurityPolicy.tripleDesSha256Rsa15.copy();
-		tmpSpt.setProcessTokenMethod(this);
-		spt.setChildToken(tmpSpt);
-
-		tmpSpt = SecurityPolicy.inclusiveC14N.copy();
-		tmpSpt.setProcessTokenMethod(this);
-		spt.setChildToken(tmpSpt);
-
-		tmpSpt = SecurityPolicy.soapNormalization10.copy();
-		tmpSpt.setProcessTokenMethod(this);
-		spt.setChildToken(tmpSpt);
-
-		tmpSpt = SecurityPolicy.strTransform10.copy();
-		tmpSpt.setProcessTokenMethod(this);
-		spt.setChildToken(tmpSpt);
-
-		tmpSpt = SecurityPolicy.xPath10.copy();
-		tmpSpt.setProcessTokenMethod(this);
-		spt.setChildToken(tmpSpt);
-
-		tmpSpt = SecurityPolicy.xPathFilter20.copy();
-		tmpSpt.setProcessTokenMethod(this);
-		spt.setChildToken(tmpSpt);
-	}
-
-	public Object doAlgorithmSuite(SecurityProcessorContext spc) {
-		log.debug("Processing "
-				+ spc.readCurrentSecurityToken().getTokenName() + ": "
-				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-
-		SecurityPolicyToken spt = spc.readCurrentSecurityToken();
-		switch (spc.getAction()) {
-
-		case SecurityProcessorContext.START:
-			if (!initializedAlgorithmSuite) {
-				try {
-					initializeAlgorithmSuite(spt);
-					initializedAlgorithmSuite = true;
-				} catch (NoSuchMethodException e) {
-					// TODO Auto-generated catch block
-					e.printStackTrace();
-					return new Boolean(false);
-				}
-			}
-			log.debug(spt.getTokenName());
-			PrimitiveAssertion pa = spc.getAssertion();
-			String text = pa.getStrValue();
-			if (text != null) {
-				text = text.trim();
-				log.debug("Value: '" + text.toString() + "'");
-			}
-		case SecurityProcessorContext.COMMIT:
-			break;
-		case SecurityProcessorContext.ABORT:
-			break;
-		}
-		return new Boolean(true);
-	}
-
-	public Object doBasic256(SecurityProcessorContext spc) {
-		log.debug("Processing "
-				+ spc.readCurrentSecurityToken().getTokenName() + ": "
-				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-		this.setAlgoGroup(spc);
-		return new Boolean(true);
-	}
-
-	public Object doBasic192(SecurityProcessorContext spc) {
-		log.debug("Processing "
-				+ spc.readCurrentSecurityToken().getTokenName() + ": "
-				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-        this.setAlgoGroup(spc);
+    /**
+     * Intialize the AlgorithmSuite complex token.
+     * 
+     * This method creates a copy of the AlgorithmSuite token and sets the
+     * handler object to the copy. Then it creates copies of the child tokens
+     * that are allowed for AlgorithmSuite. These tokens are:
+     * 
+     * These copies are also initialized with the handler object and then set as
+     * child tokens of AlgorithmSuite.
+     * 
+     * <p/> The handler object that must contain the methods
+     * <code>doAlgorithmSuite</code>.
+     * 
+     * @param spt
+     *            The token that will hold the child tokens.
+     * @throws NoSuchMethodException
+     */
+
+    private void initializeAlgorithmSuite(SecurityPolicyToken spt)
+            throws NoSuchMethodException {
+
+        SecurityPolicyToken tmpSpt;
+
+        tmpSpt = SecurityPolicy.basic256.copy();
+        tmpSpt.setProcessTokenMethod(this);
+        spt.setChildToken(tmpSpt);
+
+        tmpSpt = SecurityPolicy.basic192.copy();
+        tmpSpt.setProcessTokenMethod(this);
+        spt.setChildToken(tmpSpt);
+
+        tmpSpt = SecurityPolicy.basic128.copy();
+        tmpSpt.setProcessTokenMethod(this);
+        spt.setChildToken(tmpSpt);
+
+        tmpSpt = SecurityPolicy.tripleDes.copy();
+        tmpSpt.setProcessTokenMethod(this);
+        spt.setChildToken(tmpSpt);
+
+        tmpSpt = SecurityPolicy.basic256Rsa15.copy();
+        tmpSpt.setProcessTokenMethod(this);
+        spt.setChildToken(tmpSpt);
+
+        tmpSpt = SecurityPolicy.basic192Rsa15.copy();
+        tmpSpt.setProcessTokenMethod(this);
+        spt.setChildToken(tmpSpt);
+
+        tmpSpt = SecurityPolicy.basic128Rsa15.copy();
+        tmpSpt.setProcessTokenMethod(this);
+        spt.setChildToken(tmpSpt);
+
+        tmpSpt = SecurityPolicy.tripleDesRsa15.copy();
+        tmpSpt.setProcessTokenMethod(this);
+        spt.setChildToken(tmpSpt);
+
+        tmpSpt = SecurityPolicy.basic256Sha256.copy();
+        tmpSpt.setProcessTokenMethod(this);
+        spt.setChildToken(tmpSpt);
+
+        tmpSpt = SecurityPolicy.basic192Sha256.copy();
+        tmpSpt.setProcessTokenMethod(this);
+        spt.setChildToken(tmpSpt);
+
+        tmpSpt = SecurityPolicy.basic128Sha256.copy();
+        tmpSpt.setProcessTokenMethod(this);
+        spt.setChildToken(tmpSpt);
+
+        tmpSpt = SecurityPolicy.tripleDesSha256.copy();
+        tmpSpt.setProcessTokenMethod(this);
+        spt.setChildToken(tmpSpt);
+
+        tmpSpt = SecurityPolicy.basic256Sha256Rsa15.copy();
+        tmpSpt.setProcessTokenMethod(this);
+        spt.setChildToken(tmpSpt);
+
+        tmpSpt = SecurityPolicy.basic192Sha256Rsa15.copy();
+        tmpSpt.setProcessTokenMethod(this);
+        spt.setChildToken(tmpSpt);
+
+        tmpSpt = SecurityPolicy.basic128Sha256Rsa15.copy();
+        tmpSpt.setProcessTokenMethod(this);
+        spt.setChildToken(tmpSpt);
+
+        tmpSpt = SecurityPolicy.tripleDesSha256Rsa15.copy();
+        tmpSpt.setProcessTokenMethod(this);
+        spt.setChildToken(tmpSpt);
+
+        tmpSpt = SecurityPolicy.inclusiveC14N.copy();
+        tmpSpt.setProcessTokenMethod(this);
+        spt.setChildToken(tmpSpt);
+
+        tmpSpt = SecurityPolicy.soapNormalization10.copy();
+        tmpSpt.setProcessTokenMethod(this);
+        spt.setChildToken(tmpSpt);
+
+        tmpSpt = SecurityPolicy.strTransform10.copy();
+        tmpSpt.setProcessTokenMethod(this);
+        spt.setChildToken(tmpSpt);
+
+        tmpSpt = SecurityPolicy.xPath10.copy();
+        tmpSpt.setProcessTokenMethod(this);
+        spt.setChildToken(tmpSpt);
+
+        tmpSpt = SecurityPolicy.xPathFilter20.copy();
+        tmpSpt.setProcessTokenMethod(this);
+        spt.setChildToken(tmpSpt);
+    }
+
+    public Object doAlgorithmSuite(SecurityProcessorContext spc) {
+        log
+                .debug("Processing "
+                        + spc.readCurrentSecurityToken().getTokenName()
+                        + ": "
+                        + SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+
+        SecurityPolicyToken spt = spc.readCurrentSecurityToken();
+        switch (spc.getAction()) {
+
+        case SecurityProcessorContext.START:
+            if (!initializedAlgorithmSuite) {
+                try {
+                    initializeAlgorithmSuite(spt);
+                    initializedAlgorithmSuite = true;
+                } catch (NoSuchMethodException e) {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                    return new Boolean(false);
+                }
+            }
+            log.debug(spt.getTokenName());
+            PrimitiveAssertion pa = spc.getAssertion();
+            String text = pa.getStrValue();
+            if (text != null) {
+                text = text.trim();
+                log.debug("Value: '" + text.toString() + "'");
+            }
+        case SecurityProcessorContext.COMMIT:
+            break;
+        case SecurityProcessorContext.ABORT:
+            break;
+        }
         return new Boolean(true);
-	}
+    }
+
+    public Object doBasic256(SecurityProcessorContext spc) {
+        log
+                .debug("Processing "
+                        + spc.readCurrentSecurityToken().getTokenName()
+                        + ": "
+                        + SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        return this.setAlgoGroup(spc);
+    }
+
+    public Object doBasic192(SecurityProcessorContext spc) {
+        log
+                .debug("Processing "
+                        + spc.readCurrentSecurityToken().getTokenName()
+                        + ": "
+                        + SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        return this.setAlgoGroup(spc);
+    }
+
+    public Object doBasic128(SecurityProcessorContext spc) {
+        log
+                .debug("Processing "
+                        + spc.readCurrentSecurityToken().getTokenName()
+                        + ": "
+                        + SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        return this.setAlgoGroup(spc);
+    }
+
+    public Object doTripleDes(SecurityProcessorContext spc) {
+        log
+                .debug("Processing "
+                        + spc.readCurrentSecurityToken().getTokenName()
+                        + ": "
+                        + SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        return this.setAlgoGroup(spc);
+    }
+
+    public Object doBasic256Rsa15(SecurityProcessorContext spc) {
+        log
+                .debug("Processing "
+                        + spc.readCurrentSecurityToken().getTokenName()
+                        + ": "
+                        + SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        return this.setAlgoGroup(spc);
+    }
+
+    public Object doBasic192Rsa15(SecurityProcessorContext spc) {
+        log
+                .debug("Processing "
+                        + spc.readCurrentSecurityToken().getTokenName()
+                        + ": "
+                        + SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        return this.setAlgoGroup(spc);
+    }
+
+    public Object doBasic128Rsa15(SecurityProcessorContext spc) {
+        log
+                .debug("Processing "
+                        + spc.readCurrentSecurityToken().getTokenName()
+                        + ": "
+                        + SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        return this.setAlgoGroup(spc);
+    }
+
+    public Object doTripleDesRsa15(SecurityProcessorContext spc) {
+        log
+                .debug("Processing "
+                        + spc.readCurrentSecurityToken().getTokenName()
+                        + ": "
+                        + SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        return this.setAlgoGroup(spc);
+    }
+
+    public Object doBasic256Sha256(SecurityProcessorContext spc) {
+        log
+                .debug("Processing "
+                        + spc.readCurrentSecurityToken().getTokenName()
+                        + ": "
+                        + SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        return this.setAlgoGroup(spc);
+    }
 
-	public Object doBasic128(SecurityProcessorContext spc) {
-		log.debug("Processing "
-				+ spc.readCurrentSecurityToken().getTokenName() + ": "
-				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-        this.setAlgoGroup(spc);
-		return new Boolean(true);
-	}
-
-	public Object doTripleDes(SecurityProcessorContext spc) {
-		log.debug("Processing "
-				+ spc.readCurrentSecurityToken().getTokenName() + ": "
-				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-        this.setAlgoGroup(spc);
-		return new Boolean(true);
-	}
-
-	public Object doBasic256Rsa15(SecurityProcessorContext spc) {
-		log.debug("Processing "
-				+ spc.readCurrentSecurityToken().getTokenName() + ": "
-				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-        this.setAlgoGroup(spc);
-		return new Boolean(true);
-	}
-
-	public Object doBasic192Rsa15(SecurityProcessorContext spc) {
-		log.debug("Processing "
-				+ spc.readCurrentSecurityToken().getTokenName() + ": "
-				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-        this.setAlgoGroup(spc);
-		return new Boolean(true);
-	}
-
-	public Object doBasic128Rsa15(SecurityProcessorContext spc) {
-		log.debug("Processing "
-				+ spc.readCurrentSecurityToken().getTokenName() + ": "
-				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-        this.setAlgoGroup(spc);
-		return new Boolean(true);
-	}
-
-	public Object doTripleDesRsa15(SecurityProcessorContext spc) {
-		log.debug("Processing "
-				+ spc.readCurrentSecurityToken().getTokenName() + ": "
-				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-        this.setAlgoGroup(spc);
-		return new Boolean(true);
-	}
-
-	public Object doBasic256Sha256(SecurityProcessorContext spc) {
-		log.debug("Processing "
-				+ spc.readCurrentSecurityToken().getTokenName() + ": "
-				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-        this.setAlgoGroup(spc);
-		return new Boolean(true);
-	}
-
-	public Object doBasic192Sha256(SecurityProcessorContext spc) {
-		log.debug("Processing "
-				+ spc.readCurrentSecurityToken().getTokenName() + ": "
-				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-        this.setAlgoGroup(spc);
-		return new Boolean(true);
-	}
-
-	public Object doBasic128Sha256(SecurityProcessorContext spc) {
-		log.debug("Processing "
-				+ spc.readCurrentSecurityToken().getTokenName() + ": "
-				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-        this.setAlgoGroup(spc);
-		return new Boolean(true);
-	}
-
-	public Object doTripleDesSha256(SecurityProcessorContext spc) {
-		log.debug("Processing "
-				+ spc.readCurrentSecurityToken().getTokenName() + ": "
-				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-        this.setAlgoGroup(spc);
-		return new Boolean(true);
-	}
-
-	public Object doBasic256Sha256Rsa15(SecurityProcessorContext spc) {
-		log.debug("Processing "
-				+ spc.readCurrentSecurityToken().getTokenName() + ": "
-				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-        this.setAlgoGroup(spc);
-		return new Boolean(true);
-	}
-
-	public Object doBasic192Sha256Rsa15(SecurityProcessorContext spc) {
-		log.debug("Processing "
-				+ spc.readCurrentSecurityToken().getTokenName() + ": "
-				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-        this.setAlgoGroup(spc);
-		return new Boolean(true);
-	}
-
-	public Object doBasic128Sha256Rsa15(SecurityProcessorContext spc) {
-		log.debug("Processing "
-				+ spc.readCurrentSecurityToken().getTokenName() + ": "
-				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-        this.setAlgoGroup(spc);
-		return new Boolean(true);
-	}
-
-	public Object doTripleDesSha256Rsa15(SecurityProcessorContext spc) {
-		log.debug("Processing "
-				+ spc.readCurrentSecurityToken().getTokenName() + ": "
-				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-        this.setAlgoGroup(spc);
-		return new Boolean(true);
-	}
-
-	public Object doInclusiveC14N(SecurityProcessorContext spc) {
-		log.debug("Processing "
-				+ spc.readCurrentSecurityToken().getTokenName() + ": "
-				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-        AlgorithmSuite algoSuite = (AlgorithmSuite)spc.readCurrentPolicyEngineData();
-        if(spc.getAction() == SecurityProcessorContext.COMMIT) {
+    public Object doBasic192Sha256(SecurityProcessorContext spc) {
+        log
+                .debug("Processing "
+                        + spc.readCurrentSecurityToken().getTokenName()
+                        + ": "
+                        + SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        return this.setAlgoGroup(spc);
+    }
+
+    public Object doBasic128Sha256(SecurityProcessorContext spc) {
+        log
+                .debug("Processing "
+                        + spc.readCurrentSecurityToken().getTokenName()
+                        + ": "
+                        + SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        return this.setAlgoGroup(spc);
+    }
+
+    public Object doTripleDesSha256(SecurityProcessorContext spc) {
+        log
+                .debug("Processing "
+                        + spc.readCurrentSecurityToken().getTokenName()
+                        + ": "
+                        + SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        return this.setAlgoGroup(spc);
+    }
+
+    public Object doBasic256Sha256Rsa15(SecurityProcessorContext spc) {
+        log
+                .debug("Processing "
+                        + spc.readCurrentSecurityToken().getTokenName()
+                        + ": "
+                        + SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        return this.setAlgoGroup(spc);
+    }
+
+    public Object doBasic192Sha256Rsa15(SecurityProcessorContext spc) {
+        log
+                .debug("Processing "
+                        + spc.readCurrentSecurityToken().getTokenName()
+                        + ": "
+                        + SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        return this.setAlgoGroup(spc);
+    }
+
+    public Object doBasic128Sha256Rsa15(SecurityProcessorContext spc) {
+        log
+                .debug("Processing "
+                        + spc.readCurrentSecurityToken().getTokenName()
+                        + ": "
+                        + SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        return this.setAlgoGroup(spc);
+    }
+
+    public Object doTripleDesSha256Rsa15(SecurityProcessorContext spc) {
+        log
+                .debug("Processing "
+                        + spc.readCurrentSecurityToken().getTokenName()
+                        + ": "
+                        + SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        return this.setAlgoGroup(spc);
+    }
+
+    public Object doInclusiveC14N(SecurityProcessorContext spc) {
+        log
+                .debug("Processing "
+                        + spc.readCurrentSecurityToken().getTokenName()
+                        + ": "
+                        + SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        AlgorithmSuite algoSuite = (AlgorithmSuite) spc
+                .readCurrentPolicyEngineData();
+        if (spc.getAction() == SecurityProcessorContext.START) {
             try {
                 algoSuite.setC14n(Constants.C14N);
             } catch (WSSPolicyException e) {
-                // TODO Throw this out
-                e.printStackTrace();
+                log.error(e.getMessage(), e);
+                return new Boolean(false);
             }
         }
         return new Boolean(true);
-	}
+    }
 
-	public Object doSoapNormalization10(SecurityProcessorContext spc) {
-		log.debug("Processing "
-				+ spc.readCurrentSecurityToken().getTokenName() + ": "
-				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-        AlgorithmSuite algoSuite = (AlgorithmSuite)spc.readCurrentPolicyEngineData();
-        if(spc.getAction() == SecurityProcessorContext.COMMIT) {
+    public Object doSoapNormalization10(SecurityProcessorContext spc) {
+        log
+                .debug("Processing "
+                        + spc.readCurrentSecurityToken().getTokenName()
+                        + ": "
+                        + SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        AlgorithmSuite algoSuite = (AlgorithmSuite) spc
+                .readCurrentPolicyEngineData();
+        if (spc.getAction() == SecurityProcessorContext.START) {
             try {
                 algoSuite.setSoapNormalization(Constants.SNT);
             } catch (WSSPolicyException e) {
-                // TODO Throw this out
-                e.printStackTrace();
+                log.error(e.getMessage(), e);
+                return new Boolean(false);
             }
         }
-		return new Boolean(true);
-	}
+        return new Boolean(true);
+    }
 
-	public Object doStrTransform10(SecurityProcessorContext spc) {
-		log.debug("Processing "
-				+ spc.readCurrentSecurityToken().getTokenName() + ": "
-				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-        AlgorithmSuite algoSuite = (AlgorithmSuite)spc.readCurrentPolicyEngineData();
-        if(spc.getAction() == SecurityProcessorContext.COMMIT) {
+    public Object doStrTransform10(SecurityProcessorContext spc) {
+        log
+                .debug("Processing "
+                        + spc.readCurrentSecurityToken().getTokenName()
+                        + ": "
+                        + SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        AlgorithmSuite algoSuite = (AlgorithmSuite) spc
+                .readCurrentPolicyEngineData();
+        if (spc.getAction() == SecurityProcessorContext.START) {
             try {
                 algoSuite.setStrTransform(Constants.STRT10);
             } catch (WSSPolicyException e) {
-                // TODO Throw this out
-                e.printStackTrace();
+                log.error(e.getMessage(), e);
+                return new Boolean(false);
             }
         }
-		return new Boolean(true);
-	}
+        return new Boolean(true);
+    }
 
-	public Object doXPath10(SecurityProcessorContext spc) {
-		log.debug("Processing "
-				+ spc.readCurrentSecurityToken().getTokenName() + ": "
-				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-        AlgorithmSuite algoSuite = (AlgorithmSuite)spc.readCurrentPolicyEngineData();
-        if(spc.getAction() == SecurityProcessorContext.COMMIT) {
+    public Object doXPath10(SecurityProcessorContext spc) {
+        log
+                .debug("Processing "
+                        + spc.readCurrentSecurityToken().getTokenName()
+                        + ": "
+                        + SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        AlgorithmSuite algoSuite = (AlgorithmSuite) spc
+                .readCurrentPolicyEngineData();
+        if (spc.getAction() == SecurityProcessorContext.START) {
             try {
                 algoSuite.setXPath(Constants.XPATH);
             } catch (WSSPolicyException e) {
-                // TODO Throw this out
-                e.printStackTrace();
+                log.error(e.getMessage(), e);
+                return new Boolean(false);
             }
         }
-		return new Boolean(true);
-	}
+        return new Boolean(true);
+    }
 
-	public Object doXPathFilter20(SecurityProcessorContext spc) {
-		log.debug("Processing "
-				+ spc.readCurrentSecurityToken().getTokenName() + ": "
-				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-        AlgorithmSuite algoSuite = (AlgorithmSuite)spc.readCurrentPolicyEngineData();
-        if(spc.getAction() == SecurityProcessorContext.COMMIT) {
+    public Object doXPathFilter20(SecurityProcessorContext spc) {
+        log
+                .debug("Processing "
+                        + spc.readCurrentSecurityToken().getTokenName()
+                        + ": "
+                        + SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        AlgorithmSuite algoSuite = (AlgorithmSuite) spc
+                .readCurrentPolicyEngineData();
+        if (spc.getAction() == SecurityProcessorContext.START) {
             try {
                 algoSuite.setXPath(Constants.XPATH20);
             } catch (WSSPolicyException e) {
-                // TODO Throw this out
-                e.printStackTrace();
+                log.error(e.getMessage(), e);
+                return new Boolean(false);
             }
         }
-		return new Boolean(true);
-	}
+        return new Boolean(true);
+    }
 
-    private void setAlgoGroup(SecurityProcessorContext spc) {
-        if(spc.getAction() == 2) {
+    private Boolean setAlgoGroup(SecurityProcessorContext spc) {
+        if (spc.getAction() == SecurityProcessorContext.START) {
             try {
-                AlgorithmSuite algoSuite = (AlgorithmSuite)spc.readCurrentPolicyEngineData();
-                algoSuite.setAlgorithmSuite(spc.getAssertion().getName().getLocalPart());
-                ((AlgorithmWrapper)spc.readPreviousPolicyEngineData()).setAlgorithmSuite(algoSuite);
+                AlgorithmSuite algoSuite = (AlgorithmSuite) spc
+                        .readCurrentPolicyEngineData();
+                algoSuite.setAlgorithmSuite(spc.getAssertion().getName()
+                        .getLocalPart());
+                ((AlgorithmWrapper) spc.readPreviousPolicyEngineData())
+                        .setAlgorithmSuite(algoSuite);
             } catch (WSSPolicyException e) {
-                // TODO row this out
-                e.printStackTrace();
+                log.error(e.getMessage(), e);
+                return new Boolean(false);                
             }
-        }        
+        }
+        return new Boolean(true);
     }
-    
+
 }

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/AsymmetricBindingProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/AsymmetricBindingProcessor.java?rev=373316&r1=373315&r2=373316&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/AsymmetricBindingProcessor.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/AsymmetricBindingProcessor.java Sun Jan 29 07:17:44 2006
@@ -17,7 +17,11 @@
 
 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.model.Binding;
+import org.apache.ws.security.policy.model.AsymmetricBinding;
+import org.apache.ws.security.policy.model.SymmetricBinding;
 import org.apache.ws.security.policy.parser.SecurityPolicy;
 import org.apache.ws.security.policy.parser.SecurityPolicyToken;
 import org.apache.ws.security.policy.parser.SecurityProcessorContext;
@@ -35,12 +39,12 @@
 	/**
 	 * Intialize the AsymmetricBinding complex token.
 	 * 
-	 * This method creates a copy of the SymmetricBinding token and sets the
+	 * This method creates a copy of the AsymmetricBinding token and sets the
 	 * handler object to the copy. Then it creates copies of the child tokens
-	 * that are allowed for SymmetricBinding. These tokens are:
+	 * that are allowed for AsymmetricBinding. These tokens are:
 	 * 
 	 * These copies are also initialized with the handler object and then set as
-	 * child tokens of SymmetricBinding.
+	 * child tokens of AsymmetricBinding.
 	 * 
 	 * @param spt
 	 *            The token that will hold the child tokens.
@@ -90,7 +94,11 @@
 		tmpSpt.setProcessTokenMethod(this);
 		spt.setChildToken(tmpSpt);
 
-		tmpSpt = SecurityPolicy.encryptSignature.copy();
+        tmpSpt = SecurityPolicy.signBeforeEncrypting.copy();
+        tmpSpt.setProcessTokenMethod(this);
+        spt.setChildToken(tmpSpt);
+
+        tmpSpt = SecurityPolicy.encryptSignature.copy();
 		tmpSpt.setProcessTokenMethod(this);
 		spt.setChildToken(tmpSpt);
 
@@ -142,17 +150,43 @@
 		return new Boolean(true);
 	}
 
-	public Object doEncryptBeforeSigning(SecurityProcessorContext spc) {
-		log.debug("Processing "
-				+ spc.readCurrentSecurityToken().getTokenName() + ": "
-				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-		return new Boolean(true);
-	}
+    public Object doEncryptBeforeSigning(SecurityProcessorContext spc) {
+        log.debug("Processing "
+                + spc.readCurrentSecurityToken().getTokenName() + ": "
+                + SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        if(spc.getAction() == SecurityProcessorContext.START) {
+            try {
+                ((AsymmetricBinding) spc.readCurrentPolicyEngineData()).setProtectionOrder(spc
+                        .getAssertion().getName().getLocalPart());
+            } catch (WSSPolicyException e) {
+                return new Boolean(false);
+            }
+        }
+        return new Boolean(true);
+    }
 
-	public Object doEncryptSignature(SecurityProcessorContext spc) {
+    public Object doSignBeforeEncrypting(SecurityProcessorContext spc) {
+        log.debug("Processing "
+                + spc.readCurrentSecurityToken().getTokenName() + ": "
+                + SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        if(spc.getAction() == SecurityProcessorContext.START) {
+            try {
+                ((AsymmetricBinding) spc.readCurrentPolicyEngineData()).setProtectionOrder(spc
+                        .getAssertion().getName().getLocalPart());
+            } catch (WSSPolicyException e) {
+                return new Boolean(false);
+            }
+        }
+        return new Boolean(true);
+    }
+    
+    public Object doEncryptSignature(SecurityProcessorContext spc) {
 		log.debug("Processing "
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        if(spc.getAction() == SecurityProcessorContext.START) {
+            ((AsymmetricBinding)spc.readCurrentPolicyEngineData()).setSignatureProtection(true);
+        }
 		return new Boolean(true);
 	}
 
@@ -160,6 +194,9 @@
 		log.debug("Processing "
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        if(spc.getAction() == SecurityProcessorContext.START) {
+            ((AsymmetricBinding)spc.readCurrentPolicyEngineData()).setTokenProtection(true);
+        }
 		return new Boolean(true);
 	}
 
@@ -167,6 +204,9 @@
 		log.debug("Processing "
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        if(spc.getAction() == SecurityProcessorContext.START) {
+            ((AsymmetricBinding)spc.readCurrentPolicyEngineData()).setEntireHeaderAndBodySignatures(true);
+        }
 		return new Boolean(true);
 	}
 }

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/EncryptedPartsElementsProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/EncryptedPartsElementsProcessor.java?rev=373316&r1=373315&r2=373316&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/EncryptedPartsElementsProcessor.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/EncryptedPartsElementsProcessor.java Sun Jan 29 07:17:44 2006
@@ -174,7 +174,7 @@
 		log.debug("Processing "
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-        if(spc.getAction() == 2) {
+        if(spc.getAction() == SecurityProcessorContext.START) {
             ((SignedEncryptedParts)spc.readCurrentPolicyEngineData()).setBody(true);
         }
 		return new Boolean(true);
@@ -185,7 +185,7 @@
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
         
-        if(spc.getAction() == 2) {
+        if(spc.getAction() == SecurityProcessorContext.START) {
             //Extract the sp:Header/@Name and sp:Header/@Namespace attrs
             //And create a Header
             Header header = new Header();
@@ -201,7 +201,7 @@
 		log.debug("Processing "
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-        if(spc.getAction() == 2) {
+        if(spc.getAction() == SecurityProcessorContext.START) {
             ((SignedEncryptedElements) spc.readCurrentPolicyEngineData())
                     .addXPathExpression(spc.getAssertion().getStrValue());
         }

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/LayoutProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/LayoutProcessor.java?rev=373316&r1=373315&r2=373316&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/LayoutProcessor.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/LayoutProcessor.java Sun Jan 29 07:17:44 2006
@@ -112,14 +112,14 @@
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
         try {
-            if(spc.getAction() == 2) {
+            if(spc.getAction() == SecurityProcessorContext.START) {
                 Layout layout = (Layout) spc.readCurrentPolicyEngineData();
                 layout.setValue(spc.getAssertion().getName().getLocalPart());
                 ((Binding)spc.readPreviousPolicyEngineData()).setLayout(layout);
             }
         } catch (WSSPolicyException e) {
-            // TODO Throw this exception out
-            e.printStackTrace();
+            log.error(e.getMessage(), e);
+            return new Boolean(false);                
         }
 		return new Boolean(true);
 	}
@@ -129,14 +129,14 @@
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
         try {
-            if(spc.getAction() == 2) {
+            if(spc.getAction() == SecurityProcessorContext.START) {
                 Layout layout = (Layout) spc.readCurrentPolicyEngineData();
                 layout.setValue(spc.getAssertion().getName().getLocalPart());
                 ((Binding)spc.readPreviousPolicyEngineData()).setLayout(layout);
             }
         } catch (WSSPolicyException e) {
-            // TODO Throw this exception out
-            e.printStackTrace();
+            log.error(e.getMessage(), e);
+            return new Boolean(false);                
         }
 		return new Boolean(true);
 	}
@@ -146,14 +146,14 @@
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
         try {
-            if(spc.getAction() == 2) {
+            if(spc.getAction() == SecurityProcessorContext.START) {
                 Layout layout = (Layout) spc.readCurrentPolicyEngineData();
                 layout.setValue(spc.getAssertion().getName().getLocalPart());
                 ((Binding)spc.readPreviousPolicyEngineData()).setLayout(layout);
             }
         } catch (WSSPolicyException e) {
-            // TODO Throw this exception out
-            e.printStackTrace();
+            log.error(e.getMessage(), e);
+            return new Boolean(false);                
         }
 		return new Boolean(true);
 	}
@@ -163,14 +163,14 @@
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
         try {
-            if(spc.getAction() == 2) {
+            if(spc.getAction() == SecurityProcessorContext.START) {
                 Layout layout = (Layout) spc.readCurrentPolicyEngineData();
                 layout.setValue(spc.getAssertion().getName().getLocalPart());
                 ((Binding)spc.readPreviousPolicyEngineData()).setLayout(layout);
             }
         } catch (WSSPolicyException e) {
-            // TODO Throw this exception out
-            e.printStackTrace();
+            log.error(e.getMessage(), e);
+            return new Boolean(false);                
         }
 		return new Boolean(true);
 	}

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/SignedPartsElementsProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/SignedPartsElementsProcessor.java?rev=373316&r1=373315&r2=373316&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/SignedPartsElementsProcessor.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/SignedPartsElementsProcessor.java Sun Jan 29 07:17:44 2006
@@ -181,7 +181,7 @@
 		log.debug("Processing "
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-            if(spc.getAction() == 2) {
+            if(spc.getAction() == SecurityProcessorContext.START) {
                 ((SignedEncryptedParts)spc.readCurrentPolicyEngineData()).setBody(true);
             }
 		return new Boolean(true);
@@ -191,7 +191,7 @@
 		log.debug("Processing "
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-        if(spc.getAction() == 2) {
+        if(spc.getAction() == SecurityProcessorContext.START) {
             //Extract the sp:Header/@Name and sp:Header/@Namespace attrs
             //And create a Header
             Header header = new Header();
@@ -206,7 +206,7 @@
 		log.debug("Processing "
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-        if(spc.getAction() == 2) {
+        if(spc.getAction() == SecurityProcessorContext.START) {
             ((SignedEncryptedElements) spc.readCurrentPolicyEngineData())
                     .addXPathExpression(spc.getAssertion().getStrValue());
         }

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/SymmetricBindingProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/SymmetricBindingProcessor.java?rev=373316&r1=373315&r2=373316&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/SymmetricBindingProcessor.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/SymmetricBindingProcessor.java Sun Jan 29 07:17:44 2006
@@ -98,6 +98,10 @@
 		tmpSpt.setProcessTokenMethod(this);
 		spt.setChildToken(tmpSpt);
 
+        tmpSpt = SecurityPolicy.signBeforeEncrypting.copy();
+        tmpSpt.setProcessTokenMethod(this);
+        spt.setChildToken(tmpSpt);
+
 		tmpSpt = SecurityPolicy.encryptSignature.copy();
 		tmpSpt.setProcessTokenMethod(this);
 		spt.setChildToken(tmpSpt);
@@ -164,6 +168,21 @@
         }
 		return new Boolean(true);
 	}
+
+    public Object doSignBeforeEncrypting(SecurityProcessorContext spc) {
+        log.debug("Processing "
+                + spc.readCurrentSecurityToken().getTokenName() + ": "
+                + SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        if(spc.getAction() == SecurityProcessorContext.START) {
+            try {
+                ((SymmetricBinding) spc.readCurrentPolicyEngineData()).setProtectionOrder(spc
+                        .getAssertion().getName().getLocalPart());
+            } catch (WSSPolicyException e) {
+                return new Boolean(false);
+            }
+        }
+        return new Boolean(true);
+    }
 
 	public Object doEncryptSignature(SecurityProcessorContext spc) {
 	    log.debug("Processing "

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/UsernameTokenProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/UsernameTokenProcessor.java?rev=373316&r1=373315&r2=373316&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/UsernameTokenProcessor.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/UsernameTokenProcessor.java Sun Jan 29 07:17:44 2006
@@ -89,14 +89,13 @@
                         }
                         ((TokenWrapper)spc.readPreviousPolicyEngineData()).setToken(unt);
                     } catch (WSSPolicyException e) {
-                        // TODO Throw this out
-                        e.printStackTrace();
+                        log.error(e.getMessage(), e);
+                        return new Boolean(false);
                     }
 					initializedUsernameToken = true;
 				} catch (NoSuchMethodException e) {
-					// TODO Auto-generated catch block
-					e.printStackTrace();
-					return new Boolean(false);
+                    log.error(e.getMessage(), e);
+                    return new Boolean(false);
 				}
 			}
 			log.debug(spt.getTokenName());
@@ -116,7 +115,7 @@
 
 	public Object doWssUsernameToken10(SecurityProcessorContext spc) {
 		log.debug("Processing wssUsernameToken10");
-        if(spc.getAction() == 2) {
+        if(spc.getAction() == SecurityProcessorContext.START) {
             ((UsernameToken)spc.readCurrentPolicyEngineData()).setUseUTProfile11(false);
         }
 		return new Boolean(true);
@@ -124,7 +123,7 @@
 
 	public Object doWssUsernameToken11(SecurityProcessorContext spc) {
 		log.debug("Processing wssUsernameToken11");
-        if(spc.getAction() == 2) {
+        if(spc.getAction() == SecurityProcessorContext.START) {
             ((UsernameToken)spc.readCurrentPolicyEngineData()).setUseUTProfile11(true);
         }
 		return new Boolean(true);

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/Wss10Processor.java
URL: http://svn.apache.org/viewcvs/webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/Wss10Processor.java?rev=373316&r1=373315&r2=373316&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/Wss10Processor.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/Wss10Processor.java Sun Jan 29 07:17:44 2006
@@ -110,7 +110,7 @@
 		log.debug("Processing "
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-        if(spc.getAction() == SecurityProcessorContext.COMMIT) {
+        if(spc.getAction() == SecurityProcessorContext.START) {
             ((Wss10)spc.readCurrentPolicyEngineData()).setMustSupportRefKeyIdentifier(true);
         }
 		return new Boolean(true);
@@ -120,7 +120,7 @@
 		log.debug("Processing "
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-        if(spc.getAction() == SecurityProcessorContext.COMMIT) {
+        if(spc.getAction() == SecurityProcessorContext.START) {
             ((Wss10)spc.readCurrentPolicyEngineData()).setMustSupportRefIssuerSerial(true);
         }
         return new Boolean(true);
@@ -130,7 +130,7 @@
 		log.debug("Processing "
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-        if(spc.getAction() == SecurityProcessorContext.COMMIT) {
+        if(spc.getAction() == SecurityProcessorContext.START) {
             ((Wss10)spc.readCurrentPolicyEngineData()).setMustSupportRefExternalURI(true);
         }
         return new Boolean(true);
@@ -140,7 +140,7 @@
 		log.debug("Processing "
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-        if(spc.getAction() == SecurityProcessorContext.COMMIT) {
+        if(spc.getAction() == SecurityProcessorContext.START) {
             ((Wss10)spc.readCurrentPolicyEngineData()).setMustSupportRefEmbeddedToken(true);
         }
         return new Boolean(true);

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/Wss11Processor.java
URL: http://svn.apache.org/viewcvs/webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/Wss11Processor.java?rev=373316&r1=373315&r2=373316&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/Wss11Processor.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/Wss11Processor.java Sun Jan 29 07:17:44 2006
@@ -121,7 +121,7 @@
 		log.debug("Processing "
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-        if(spc.getAction() == SecurityProcessorContext.COMMIT) {
+        if(spc.getAction() == SecurityProcessorContext.START) {
             ((Wss11)spc.readCurrentPolicyEngineData()).setMustSupportRefKeyIdentifier(true);
         }
         return new Boolean(true);
@@ -131,7 +131,7 @@
 		log.debug("Processing "
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-        if(spc.getAction() == SecurityProcessorContext.COMMIT) {
+        if(spc.getAction() == SecurityProcessorContext.START) {
             ((Wss11)spc.readCurrentPolicyEngineData()).setMustSupportRefIssuerSerial(true);
         }
         return new Boolean(true);
@@ -141,7 +141,7 @@
 		log.debug("Processing "
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-        if(spc.getAction() == SecurityProcessorContext.COMMIT) {
+        if(spc.getAction() == SecurityProcessorContext.START) {
             ((Wss11)spc.readCurrentPolicyEngineData()).setMustSupportRefExternalURI(true);
         }
         return new Boolean(true);
@@ -151,7 +151,7 @@
 		log.debug("Processing "
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-        if(spc.getAction() == SecurityProcessorContext.COMMIT) {
+        if(spc.getAction() == SecurityProcessorContext.START) {
             ((Wss11)spc.readCurrentPolicyEngineData()).setMustSupportRefEmbeddedToken(true);
         }
         return new Boolean(true);
@@ -161,7 +161,7 @@
 		log.debug("Processing "
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-        if(spc.getAction() == SecurityProcessorContext.COMMIT) {
+        if(spc.getAction() == SecurityProcessorContext.START) {
             ((Wss11)spc.readCurrentPolicyEngineData()).setMustSupportRefThumbprint(true);
         }
         return new Boolean(true);
@@ -171,7 +171,7 @@
 		log.debug("Processing "
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-        if(spc.getAction() == SecurityProcessorContext.COMMIT) {
+        if(spc.getAction() == SecurityProcessorContext.START) {
             ((Wss11)spc.readCurrentPolicyEngineData()).setMustSupportRefEncryptedKey(true);
         }
 		return new Boolean(true);
@@ -181,7 +181,7 @@
 		log.debug("Processing "
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-        if(spc.getAction() == SecurityProcessorContext.COMMIT) {
+        if(spc.getAction() == SecurityProcessorContext.START) {
             ((Wss11)spc.readCurrentPolicyEngineData()).setRequireSignatureConfirmation(true);
         }
 		return new Boolean(true);

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/X509TokenProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/X509TokenProcessor.java?rev=373316&r1=373315&r2=373316&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/X509TokenProcessor.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/policy/parser/processors/X509TokenProcessor.java Sun Jan 29 07:17:44 2006
@@ -23,6 +23,7 @@
 import org.apache.ws.security.policy.Constants;
 import org.apache.ws.security.policy.WSSPolicyException;
 import org.apache.ws.security.policy.model.TokenWrapper;
+import org.apache.ws.security.policy.model.Wss11;
 import org.apache.ws.security.policy.model.X509Token;
 import org.apache.ws.security.policy.parser.SecurityPolicy;
 import org.apache.ws.security.policy.parser.SecurityPolicyToken;
@@ -160,6 +161,9 @@
 		log.debug("Processing "
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        if(spc.getAction() == SecurityProcessorContext.START) {
+            ((X509Token)spc.readCurrentPolicyEngineData()).setRequireKeyIdentifierReference(true);
+        }
 		return new Boolean(true);
 	}
 
@@ -167,6 +171,9 @@
 		log.debug("Processing "
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        if(spc.getAction() == SecurityProcessorContext.START) {
+            ((X509Token)spc.readCurrentPolicyEngineData()).setRequireIssuerSerialReference(true);
+        }
 		return new Boolean(true);
 	}
 
@@ -174,6 +181,9 @@
 		log.debug("Processing "
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        if(spc.getAction() == SecurityProcessorContext.START) {
+            ((X509Token)spc.readCurrentPolicyEngineData()).setRequireEmbeddedTokenReference(true);
+        }
 		return new Boolean(true);
 	}
 
@@ -181,6 +191,9 @@
 		log.debug("Processing "
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        if(spc.getAction() == SecurityProcessorContext.START) {
+            ((X509Token)spc.readCurrentPolicyEngineData()).setRequireThumbprintReference(true);
+        }        
 		return new Boolean(true);
 	}
 
@@ -188,13 +201,21 @@
 		log.debug("Processing "
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
-		return new Boolean(true);
+        if(spc.getAction() == SecurityProcessorContext.START) {
+            ((X509Token)spc.readCurrentPolicyEngineData()).setTokenVersionAndType(spc
+                    .getAssertion().getName().getLocalPart());
+        }
+        return new Boolean(true);
 	}
 
 	public Object doWssX509V3Token10(SecurityProcessorContext spc) {
 		log.debug("Processing "
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        if(spc.getAction() == SecurityProcessorContext.START) {
+            ((X509Token)spc.readCurrentPolicyEngineData()).setTokenVersionAndType(spc
+                    .getAssertion().getName().getLocalPart());
+        }
 		return new Boolean(true);
 	}
 
@@ -202,6 +223,14 @@
 		log.debug("Processing "
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        if(spc.getAction() == SecurityProcessorContext.START) {
+            ((X509Token)spc.readCurrentPolicyEngineData()).setTokenVersionAndType(spc
+                    .getAssertion().getName().getLocalPart());
+        }
+        if(spc.getAction() == SecurityProcessorContext.START) {
+            ((X509Token)spc.readCurrentPolicyEngineData()).setTokenVersionAndType(spc
+                    .getAssertion().getName().getLocalPart());
+        }
 		return new Boolean(true);
 	}
 
@@ -209,6 +238,10 @@
 		log.debug("Processing "
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        if(spc.getAction() == SecurityProcessorContext.START) {
+            ((X509Token)spc.readCurrentPolicyEngineData()).setTokenVersionAndType(spc
+                    .getAssertion().getName().getLocalPart());
+        }
 		return new Boolean(true);
 	}
 
@@ -216,6 +249,10 @@
 		log.debug("Processing "
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        if(spc.getAction() == SecurityProcessorContext.START) {
+            ((X509Token)spc.readCurrentPolicyEngineData()).setTokenVersionAndType(spc
+                    .getAssertion().getName().getLocalPart());
+        }
 		return new Boolean(true);
 	}
 
@@ -223,6 +260,10 @@
 		log.debug("Processing "
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        if(spc.getAction() == SecurityProcessorContext.START) {
+            ((X509Token)spc.readCurrentPolicyEngineData()).setTokenVersionAndType(spc
+                    .getAssertion().getName().getLocalPart());
+        }
 		return new Boolean(true);
 	}
 
@@ -230,6 +271,10 @@
 		log.debug("Processing "
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        if(spc.getAction() == SecurityProcessorContext.START) {
+            ((X509Token)spc.readCurrentPolicyEngineData()).setTokenVersionAndType(spc
+                    .getAssertion().getName().getLocalPart());
+        }
 		return new Boolean(true);
 	}
 
@@ -237,6 +282,10 @@
 		log.debug("Processing "
 				+ spc.readCurrentSecurityToken().getTokenName() + ": "
 				+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        if(spc.getAction() == SecurityProcessorContext.START) {
+            ((X509Token)spc.readCurrentPolicyEngineData()).setTokenVersionAndType(spc
+                    .getAssertion().getName().getLocalPart());
+        }
 		return new Boolean(true);
 	}
 



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