cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1548603 [2/3] - in /cxf/trunk/rt/ws/security/src: main/java/org/apache/cxf/ws/security/wss4j/ main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/ test/java/org/apache/cxf/ws/security/wss4j/ test/java/org/apache/cxf/ws/security/wss4j...
Date Fri, 06 Dec 2013 17:17:20 GMT
Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxSymmetricBindingHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxSymmetricBindingHandler.java?rev=1548603&r1=1548602&r2=1548603&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxSymmetricBindingHandler.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxSymmetricBindingHandler.java Fri Dec  6 17:17:19 2013
@@ -27,7 +27,6 @@ import java.util.Map;
 
 import javax.crypto.KeyGenerator;
 import javax.crypto.SecretKey;
-import javax.security.auth.callback.CallbackHandler;
 import javax.xml.namespace.QName;
 import javax.xml.soap.SOAPException;
 
@@ -58,7 +57,9 @@ import org.apache.wss4j.policy.model.Spn
 import org.apache.wss4j.policy.model.SymmetricBinding;
 import org.apache.wss4j.policy.model.UsernameToken;
 import org.apache.wss4j.policy.model.X509Token;
+import org.apache.wss4j.stax.ConfigurationConverter;
 import org.apache.wss4j.stax.ext.WSSConstants;
+import org.apache.wss4j.stax.ext.WSSSecurityProperties;
 import org.apache.wss4j.stax.securityEvent.WSSecurityEventConstants;
 import org.apache.xml.security.algorithms.JCEMapper;
 import org.apache.xml.security.exceptions.XMLSecurityException;
@@ -79,7 +80,7 @@ public class StaxSymmetricBindingHandler
     private SoapMessage message;
     
     public StaxSymmetricBindingHandler(
-        Map<String, Object> properties, 
+        WSSSecurityProperties properties, 
         SoapMessage msg,
         SymmetricBinding sbinding,
         Map<String, SecurityTokenProvider<OutboundSecurityToken>> outboundTokens
@@ -115,13 +116,12 @@ public class StaxSymmetricBindingHandler
         }
         
         // Set up CallbackHandler which wraps the configured Handler
-        Map<String, Object> config = getProperties();
+        WSSSecurityProperties properties = getProperties();
         TokenStoreCallbackHandler callbackHandler = 
             new TokenStoreCallbackHandler(
-                (CallbackHandler)config.get(ConfigurationConstants.PW_CALLBACK_REF), 
-                WSS4JUtils.getTokenStore(message)
+                properties.getCallbackHandler(), WSS4JUtils.getTokenStore(message)
             );
-        config.put(ConfigurationConstants.PW_CALLBACK_REF, callbackHandler);
+        properties.setCallbackHandler(callbackHandler);
         
         if (sbinding.getProtectionOrder() 
             == AbstractSymmetricAsymmetricBinding.ProtectionOrder.EncryptBeforeSigning) {
@@ -135,7 +135,7 @@ public class StaxSymmetricBindingHandler
         }
         
         if (!isRequestor()) {
-            config.put(ConfigurationConstants.ENC_SYM_ENC_KEY, "false");
+            properties.setEncryptSymmetricEncrytionKey(false);
         }
         
         configureLayout(aim);
@@ -176,14 +176,9 @@ public class StaxSymmetricBindingHandler
                 || encryptionToken instanceof SpnegoContextToken) {
                 tok = getSecurityToken();
                 if (tok != null && isRequestor()) {
-                    Map<String, Object> config = getProperties();
-                    String actionToPerform = ConfigurationConstants.CUSTOM_TOKEN;
-                    if (config.containsKey(ConfigurationConstants.ACTION)) {
-                        String action = (String)config.get(ConfigurationConstants.ACTION);
-                        config.put(ConfigurationConstants.ACTION, action + " " + actionToPerform);
-                    } else {
-                        config.put(ConfigurationConstants.ACTION, actionToPerform);
-                    }
+                    WSSSecurityProperties properties = getProperties();
+                    WSSConstants.Action actionToPerform = WSSConstants.CUSTOM_TOKEN;
+                    properties.addAction(actionToPerform);
                 } else if (tok == null && !isRequestor()) {
                     org.apache.xml.security.stax.securityToken.SecurityToken securityToken = 
                         findInboundSecurityToken(WSSecurityEventConstants.SecurityContextToken);
@@ -232,8 +227,6 @@ public class StaxSymmetricBindingHandler
             if (encryptionToken != null && encrParts.size() > 0) {
                 if (isRequestor()) {
                     encrParts.addAll(encryptedTokensList);
-                } else {
-                    addSignatureConfirmation(sigParts);
                 }
                 
                 //Check for signature protection
@@ -300,14 +293,9 @@ public class StaxSymmetricBindingHandler
                     || sigToken instanceof SpnegoContextToken) {
                     sigTok = getSecurityToken();
                     if (sigTok != null && isRequestor()) {
-                        Map<String, Object> config = getProperties();
-                        String actionToPerform = ConfigurationConstants.CUSTOM_TOKEN;
-                        if (config.containsKey(ConfigurationConstants.ACTION)) {
-                            String action = (String)config.get(ConfigurationConstants.ACTION);
-                            config.put(ConfigurationConstants.ACTION, action + " " + actionToPerform);
-                        } else {
-                            config.put(ConfigurationConstants.ACTION, actionToPerform);
-                        }
+                        WSSSecurityProperties properties = getProperties();
+                        WSSConstants.Action actionToPerform = WSSConstants.CUSTOM_TOKEN;
+                        properties.addAction(actionToPerform);
                     } else if (sigTok == null && !isRequestor()) {
                         org.apache.xml.security.stax.securityToken.SecurityToken securityToken = 
                             findInboundSecurityToken(WSSecurityEventConstants.SecurityContextToken);
@@ -363,16 +351,13 @@ public class StaxSymmetricBindingHandler
             
             addSupportingTokens();
             
-            if (isRequestor()) {
-                Map<String, Object> config = getProperties();
-                if (config.containsKey(ConfigurationConstants.ACTION)) {
-                    String action = (String)config.get(ConfigurationConstants.ACTION);
-                    if (action.contains(ConfigurationConstants.SAML_TOKEN_SIGNED)
-                        && action.contains(ConfigurationConstants.SIGNATURE)) {
-                        String newAction = action.replaceFirst(ConfigurationConstants.SIGNATURE, "").trim();
-                        config.put(ConfigurationConstants.ACTION, newAction);
-                    }
-                } 
+            WSSSecurityProperties properties = getProperties();
+            if (isRequestor() && properties.getActions() != null) {
+                List<WSSConstants.Action> actionList = properties.getActions();
+                if (actionList.contains(WSSConstants.SAML_TOKEN_SIGNED)
+                    && actionList.contains(WSSConstants.SIGNATURE)) {
+                    actionList.remove(WSSConstants.SIGNATURE);
+                }
             }
 
             //Encryption
@@ -407,112 +392,84 @@ public class StaxSymmetricBindingHandler
             AlgorithmSuite algorithmSuite = sbinding.getAlgorithmSuite();
 
             // Action
-            Map<String, Object> config = getProperties();
-            String actionToPerform = ConfigurationConstants.ENCRYPT;
+            WSSSecurityProperties properties = getProperties();
+            WSSConstants.Action actionToPerform = WSSConstants.ENCRYPT;
             if (recToken.getToken().getDerivedKeys() == DerivedKeys.RequireDerivedKeys) {
-                actionToPerform = ConfigurationConstants.ENCRYPT_DERIVED;
+                actionToPerform = WSSConstants.ENCRYPT_WITH_DERIVED_KEY;
                 if (MessageUtils.isRequestor(message) && recToken.getToken() instanceof X509Token) {
-                    config.put(ConfigurationConstants.DERIVED_TOKEN_REFERENCE, "EncryptedKey");
+                    properties.setDerivedKeyTokenReference(
+                        ConfigurationConverter.convertDerivedReference("EncryptedKey"));
                 } else {
-                    config.put(ConfigurationConstants.DERIVED_TOKEN_REFERENCE, "DirectReference");
+                    properties.setDerivedKeyTokenReference(
+                        ConfigurationConverter.convertDerivedReference("DirectReference"));
                 }
                 AlgorithmSuiteType algSuiteType = sbinding.getAlgorithmSuite().getAlgorithmSuiteType();
-                config.put(ConfigurationConstants.DERIVED_ENCRYPTION_KEY_LENGTH,
-                           "" + algSuiteType.getEncryptionDerivedKeyLength() / 8);
+                properties.setDerivedEncryptionKeyLength(
+                           algSuiteType.getEncryptionDerivedKeyLength() / 8);
             }
 
             if (recToken.getVersion() == SPConstants.SPVersion.SP12) {
-                config.put(ConfigurationConstants.USE_2005_12_NAMESPACE, "true");
+                properties.setUse200512Namespace(true);
             }
             
-            if (config.containsKey(ConfigurationConstants.ACTION)) {
-                String action = (String)config.get(ConfigurationConstants.ACTION);
-                config.put(ConfigurationConstants.ACTION, action + " " + actionToPerform);
-            } else {
-                config.put(ConfigurationConstants.ACTION, actionToPerform);
-            }
-
-            String parts = "";
-            if (config.containsKey(ConfigurationConstants.ENCRYPTION_PARTS)) {
-                parts = (String)config.get(ConfigurationConstants.ENCRYPTION_PARTS);
-                if (!parts.endsWith(";")) {
-                    parts += ";";
-                }
+            for (SecurePart encPart : encrParts) {
+                properties.addEncryptionPart(encPart);
             }
             
-            String optionalParts = "";
-            if (config.containsKey(ConfigurationConstants.OPTIONAL_ENCRYPTION_PARTS)) {
-                optionalParts = (String)config.get(ConfigurationConstants.OPTIONAL_ENCRYPTION_PARTS);
-                if (!optionalParts.endsWith(";")) {
-                    optionalParts += ";";
-                }
-            }
-
-            if (encrParts != null) {
-                for (SecurePart part : encrParts) {
-                    QName name = part.getName();
-                    String modifier = part.getModifier().getModifier();
-                    if (modifier == null || Modifier.Element.getModifier().equals(modifier)) {
-                        modifier = "Element";
-                    } else {
-                        modifier = "Content";
-                    }
-                    
-                    String parsedPart = "";
-                    if (name != null) {
-                        parsedPart = "{" + modifier + "}{" + name.getNamespaceURI() + "}" + name.getLocalPart() + ";";
-                    } else {
-                        parsedPart = "{" + modifier + "}" + part.getExternalReference() + ";";
-                    }
-                    
-                    if (part.isRequired()) {
-                        parts += parsedPart;
-                    } else {
-                        optionalParts += parsedPart;
-                    }
-                }
-            }
-
-            config.put(ConfigurationConstants.ENCRYPTION_PARTS, parts);
-            config.put(ConfigurationConstants.OPTIONAL_ENCRYPTION_PARTS, optionalParts);
+            properties.addAction(actionToPerform);
 
             if (isRequestor()) {
-                config.put(ConfigurationConstants.ENC_KEY_ID, 
-                       getKeyIdentifierType(recToken, encrToken));
-                config.put(ConfigurationConstants.DERIVED_TOKEN_KEY_ID, "DirectReference");
+                properties.setEncryptionKeyIdentifier(
+                    ConfigurationConverter.convertKeyIdentifier(
+                        getKeyIdentifierType(recToken, encrToken)));
+                properties.setDerivedKeyKeyIdentifier(
+                    ConfigurationConverter.convertKeyIdentifier("DirectReference"));
             } else if (recToken.getToken() instanceof KerberosToken && !isRequestor()) {
-                config.put(ConfigurationConstants.ENC_KEY_ID, "KerberosSHA1");
-                config.put(ConfigurationConstants.DERIVED_TOKEN_KEY_ID, "KerberosSHA1");
+                properties.setEncryptionKeyIdentifier(
+                    ConfigurationConverter.convertKeyIdentifier("KerberosSHA1"));
+                properties.setDerivedKeyKeyIdentifier(
+                    ConfigurationConverter.convertKeyIdentifier("KerberosSHA1"));
                 if (recToken.getToken().getDerivedKeys() == DerivedKeys.RequireDerivedKeys) {
-                    config.put(ConfigurationConstants.ENC_KEY_ID, "DirectReference");
+                    properties.setEncryptionKeyIdentifier(
+                        ConfigurationConverter.convertKeyIdentifier("DirectReference"));
                 }
             } else if ((recToken.getToken() instanceof IssuedToken 
                 || recToken.getToken() instanceof SecureConversationToken
                 || recToken.getToken() instanceof SpnegoContextToken) && !isRequestor()) {
-                config.put(ConfigurationConstants.ENC_KEY_ID, "DirectReference");
+                properties.setEncryptionKeyIdentifier(
+                    ConfigurationConverter.convertKeyIdentifier("DirectReference"));
             } else {
-                config.put(ConfigurationConstants.ENC_KEY_ID, "EncryptedKeySHA1");
+                properties.setEncryptionKeyIdentifier(
+                    ConfigurationConverter.convertKeyIdentifier("EncryptedKeySHA1"));
                 if (recToken.getToken().getDerivedKeys() == DerivedKeys.RequireDerivedKeys) {
-                    config.put(ConfigurationConstants.DERIVED_TOKEN_KEY_ID, "EncryptedKeySHA1");
-                    config.put(ConfigurationConstants.ENC_KEY_ID, "DirectReference");
-                    config.put(ConfigurationConstants.ENC_SYM_ENC_KEY, "false");
+                    properties.setDerivedKeyKeyIdentifier(
+                        ConfigurationConverter.convertKeyIdentifier("EncryptedKeySHA1"));
+                    properties.setEncryptionKeyIdentifier(
+                        ConfigurationConverter.convertKeyIdentifier("DirectReference"));
+                    properties.setEncryptSymmetricEncrytionKey(false);
                 }
             }
 
-            config.put(ConfigurationConstants.ENC_KEY_TRANSPORT, 
+            properties.setEncryptionKeyTransportAlgorithm(
                        algorithmSuite.getAlgorithmSuiteType().getAsymmetricKeyWrap());
-            config.put(ConfigurationConstants.ENC_SYM_ALGO, 
+            properties.setEncryptionSymAlgorithm(
                        algorithmSuite.getAlgorithmSuiteType().getEncryption());
 
             String encUser = (String)message.getContextualProperty(SecurityConstants.ENCRYPT_USERNAME);
-            if (encUser != null) {
-                config.put(ConfigurationConstants.ENCRYPTION_USER, encUser);
+            if (encUser == null) {
+                encUser = (String)message.getContextualProperty(SecurityConstants.USERNAME);
+            }
+            if (encUser != null && properties.getEncryptionUser() == null) {
+                properties.setEncryptionUser(encUser);
+            }
+            if (ConfigurationConstants.USE_REQ_SIG_CERT.equals(encUser)) {
+                properties.setUseReqSigCertForEncryption(true);
             }
             
             if (encrToken instanceof KerberosToken || encrToken instanceof IssuedToken
                 || encrToken instanceof SpnegoContextToken || encrToken instanceof SecurityContextToken
                 || encrToken instanceof SecureConversationToken) {
-                config.put(ConfigurationConstants.ENC_SYM_ENC_KEY, "false");
+                properties.setEncryptSymmetricEncrytionKey(false);
             }
         }
     }
@@ -522,118 +479,90 @@ public class StaxSymmetricBindingHandler
         throws WSSecurityException, SOAPException {
         
         // Action
-        Map<String, Object> config = getProperties();
-        String actionToPerform = ConfigurationConstants.SIGNATURE;
+        WSSSecurityProperties properties = getProperties();
+        WSSConstants.Action actionToPerform = WSSConstants.SIGNATURE;
         if (wrapper.getToken().getDerivedKeys() == DerivedKeys.RequireDerivedKeys) {
-            actionToPerform = ConfigurationConstants.SIGNATURE_DERIVED;
+            actionToPerform = WSSConstants.SIGNATURE_WITH_DERIVED_KEY;
             if (MessageUtils.isRequestor(message) && policyToken instanceof X509Token) {
-                config.put(ConfigurationConstants.DERIVED_TOKEN_REFERENCE, "EncryptedKey");
+                properties.setDerivedKeyTokenReference(
+                    ConfigurationConverter.convertDerivedReference("EncryptedKey"));
             } else {
-                config.put(ConfigurationConstants.DERIVED_TOKEN_REFERENCE, "DirectReference");
+                properties.setDerivedKeyTokenReference(
+                    ConfigurationConverter.convertDerivedReference("DirectReference"));
             }
             AlgorithmSuiteType algSuiteType = sbinding.getAlgorithmSuite().getAlgorithmSuiteType();
-            config.put(ConfigurationConstants.DERIVED_SIGNATURE_KEY_LENGTH,
-                       "" + algSuiteType.getSignatureDerivedKeyLength() / 8);
+            properties.setDerivedSignatureKeyLength(
+                       algSuiteType.getSignatureDerivedKeyLength() / 8);
         }
         
         if (policyToken.getVersion() == SPConstants.SPVersion.SP12) {
-            config.put(ConfigurationConstants.USE_2005_12_NAMESPACE, "true");
+            properties.setUse200512Namespace(true);
         }
         
-        if (config.containsKey(ConfigurationConstants.ACTION)) {
-            String action = (String)config.get(ConfigurationConstants.ACTION);
-            if (action.contains(ConfigurationConstants.KERBEROS_TOKEN)) {
-                config.put(ConfigurationConstants.ACTION, actionToPerform + " " + action);
-            } else {
-                config.put(ConfigurationConstants.ACTION, action + " " + actionToPerform);
-            }
+        List<WSSConstants.Action> actionList = properties.getActions();
+        if (actionList.contains(WSSConstants.KERBEROS_TOKEN)
+            || actionList.contains(WSSConstants.SIGNATURE_CONFIRMATION)) {
+            actionList.add(0, actionToPerform);
         } else {
-            config.put(ConfigurationConstants.ACTION, actionToPerform);
-        }
-        
-        String parts = "";
-        if (config.containsKey(ConfigurationConstants.SIGNATURE_PARTS)) {
-            parts = (String)config.get(ConfigurationConstants.SIGNATURE_PARTS);
-            if (!parts.endsWith(";")) {
-                parts += ";";
-            }
-        }
-        
-        String optionalParts = "";
-        if (config.containsKey(ConfigurationConstants.OPTIONAL_SIGNATURE_PARTS)) {
-            optionalParts = (String)config.get(ConfigurationConstants.OPTIONAL_SIGNATURE_PARTS);
-            if (!optionalParts.endsWith(";")) {
-                optionalParts += ";";
-            }
+            actionList.add(actionToPerform);
         }
-        
-        for (SecurePart part : sigParts) {
-            QName name = part.getName();
-            String modifier = part.getModifier().getModifier();
-            if (modifier == null || Modifier.Element.getModifier().equals(modifier)) {
-                modifier = "Element";
-            } else {
-                modifier = "Content";
-            }
-            
-            String parsedPart = "";
-            if (name != null) {
-                parsedPart = "{" + modifier + "}{" + name.getNamespaceURI() + "}" + name.getLocalPart() + ";";
-            } else {
-                parsedPart = "{" + modifier + "}" + part.getExternalReference() + ";";
-            }
-            
-            if (part.isRequired()) {
-                parts += parsedPart;
-            } else {
-                optionalParts += parsedPart;
-            }
+
+        for (SecurePart sigPart : sigParts) {
+            properties.addSignaturePart(sigPart);
         }
         
         AbstractToken sigToken = wrapper.getToken();
         if (sbinding.isProtectTokens() && sigToken instanceof X509Token && isRequestor()) {
-            parts += "{Element}{" + WSSConstants.NS_XMLENC + "}EncryptedKey;";
+            SecurePart securePart = 
+                new SecurePart(new QName(WSSConstants.NS_XMLENC, "EncryptedKey"), Modifier.Element);
+            properties.addSignaturePart(securePart);
         }
         
-        config.put(ConfigurationConstants.SIGNATURE_PARTS, parts);
-        config.put(ConfigurationConstants.OPTIONAL_SIGNATURE_PARTS, optionalParts);
-        
         configureSignature(wrapper, sigToken, false);
         
         if (policyToken instanceof X509Token) {
-            config.put(ConfigurationConstants.INCLUDE_SIGNATURE_TOKEN, "false");
+            properties.setIncludeSignatureToken(false);
             if (isRequestor()) {
-                config.put(ConfigurationConstants.SIG_KEY_ID, "EncryptedKey");
+                properties.setSignatureKeyIdentifier(
+                    ConfigurationConverter.convertKeyIdentifier("EncryptedKey"));
             } else {
-                config.put(ConfigurationConstants.SIG_KEY_ID, "EncryptedKeySHA1");
+                properties.setSignatureKeyIdentifier(
+                    ConfigurationConverter.convertKeyIdentifier("EncryptedKeySHA1"));
                 if (wrapper.getToken().getDerivedKeys() == DerivedKeys.RequireDerivedKeys) {
-                    config.put(ConfigurationConstants.DERIVED_TOKEN_KEY_ID, "EncryptedKeySHA1");
-                    config.put(ConfigurationConstants.SIG_KEY_ID, "DirectReference");
+                    properties.setDerivedKeyKeyIdentifier(
+                        ConfigurationConverter.convertKeyIdentifier("EncryptedKeySHA1"));
+                    properties.setSignatureKeyIdentifier(
+                        ConfigurationConverter.convertKeyIdentifier("DirectReference"));
                 }
             }
         } else if (policyToken instanceof KerberosToken) {
             if (isRequestor()) {
-                config.put(ConfigurationConstants.DERIVED_TOKEN_KEY_ID, "DirectReference");
+                properties.setDerivedKeyKeyIdentifier(
+                    ConfigurationConverter.convertKeyIdentifier("DirectReference"));
             } else {
                 if (wrapper.getToken().getDerivedKeys() == DerivedKeys.RequireDerivedKeys) {
-                    config.put(ConfigurationConstants.SIG_KEY_ID, "DirectReference");
+                    properties.setSignatureKeyIdentifier(
+                        ConfigurationConverter.convertKeyIdentifier("DirectReference"));
                 } else {
-                    config.put(ConfigurationConstants.SIG_KEY_ID, "KerberosSHA1");
+                    properties.setSignatureKeyIdentifier(
+                        ConfigurationConverter.convertKeyIdentifier("KerberosSHA1"));
                 }
-                config.put(ConfigurationConstants.DERIVED_TOKEN_KEY_ID, "KerberosSHA1");
+                properties.setDerivedKeyKeyIdentifier(
+                    ConfigurationConverter.convertKeyIdentifier("KerberosSHA1"));
             }
         } else if (policyToken instanceof IssuedToken || policyToken instanceof SecurityContextToken
             || policyToken instanceof SecureConversationToken || policyToken instanceof SpnegoContextToken) {
             if (!isRequestor()) {
-                config.put(ConfigurationConstants.INCLUDE_SIGNATURE_TOKEN, "false");
+                properties.setIncludeSignatureToken(false);
             } else {
-                config.put(ConfigurationConstants.INCLUDE_SIGNATURE_TOKEN, "true");
+                properties.setIncludeSignatureToken(true);
             }
-            config.put(ConfigurationConstants.DERIVED_TOKEN_KEY_ID, "DirectReference");
+            properties.setDerivedKeyKeyIdentifier(
+                ConfigurationConverter.convertKeyIdentifier("DirectReference"));
         }
         
         if (sigToken.getDerivedKeys() == DerivedKeys.RequireDerivedKeys) {
-            config.put(ConfigurationConstants.SIG_ALGO, 
+            properties.setSignatureAlgorithm(
                    sbinding.getAlgorithmSuite().getSymmetricSignature());
         }
     }

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxTransportBindingHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxTransportBindingHandler.java?rev=1548603&r1=1548602&r2=1548603&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxTransportBindingHandler.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxTransportBindingHandler.java Fri Dec  6 17:17:19 2013
@@ -25,7 +25,6 @@ import java.util.Map;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import javax.security.auth.callback.CallbackHandler;
 import javax.xml.namespace.QName;
 import javax.xml.soap.SOAPException;
 
@@ -37,7 +36,6 @@ import org.apache.cxf.ws.policy.Assertio
 import org.apache.cxf.ws.security.SecurityConstants;
 import org.apache.cxf.ws.security.tokenstore.SecurityToken;
 import org.apache.cxf.ws.security.wss4j.WSS4JUtils;
-import org.apache.wss4j.common.ConfigurationConstants;
 import org.apache.wss4j.policy.SP11Constants;
 import org.apache.wss4j.policy.SP12Constants;
 import org.apache.wss4j.policy.SPConstants;
@@ -62,6 +60,9 @@ import org.apache.wss4j.policy.model.X50
 import org.apache.wss4j.policy.model.XPath;
 import org.apache.wss4j.policy.stax.PolicyUtils;
 import org.apache.wss4j.stax.ext.WSSConstants;
+import org.apache.wss4j.stax.ext.WSSSecurityProperties;
+import org.apache.xml.security.stax.ext.SecurePart;
+import org.apache.xml.security.stax.ext.SecurePart.Modifier;
 import org.apache.xml.security.stax.securityToken.OutboundSecurityToken;
 import org.apache.xml.security.stax.securityToken.SecurityTokenProvider;
 
@@ -74,7 +75,7 @@ public class StaxTransportBindingHandler
     private TransportBinding tbinding;
 
     public StaxTransportBindingHandler(
-        Map<String, Object> properties, 
+        WSSSecurityProperties properties, 
         SoapMessage msg,
         TransportBinding tbinding,
         Map<String, SecurityTokenProvider<OutboundSecurityToken>> outboundTokens
@@ -281,57 +282,51 @@ public class StaxTransportBindingHandler
             SecurityToken securityToken = getSecurityToken();
             addIssuedToken(token, securityToken, false, true);
             
-            Map<String, Object> config = getProperties();
+            WSSSecurityProperties properties = getProperties();
             if (securityToken != null) {
                 storeSecurityToken(securityToken);
                 
                 // Set up CallbackHandler which wraps the configured Handler
                 TokenStoreCallbackHandler callbackHandler = 
                     new TokenStoreCallbackHandler(
-                        (CallbackHandler)config.get(ConfigurationConstants.PW_CALLBACK_REF), 
-                        WSS4JUtils.getTokenStore(message)
+                        properties.getCallbackHandler(), WSS4JUtils.getTokenStore(message)
                     );
-                config.put(ConfigurationConstants.PW_CALLBACK_REF, callbackHandler);
+                
+                properties.setCallbackHandler(callbackHandler);
             }
             
             doSignature(token, wrapper);
             
-            config.put(ConfigurationConstants.INCLUDE_SIGNATURE_TOKEN, "true");
-            config.put(ConfigurationConstants.SIG_ALGO, 
-                       tbinding.getAlgorithmSuite().getSymmetricSignature());
+            properties.setIncludeSignatureToken(true);
+            properties.setSignatureAlgorithm(
+                tbinding.getAlgorithmSuite().getSymmetricSignature());
             AlgorithmSuiteType algType = tbinding.getAlgorithmSuite().getAlgorithmSuiteType();
-            config.put(ConfigurationConstants.SIG_DIGEST_ALGO, algType.getDigest());
+            properties.setSignatureDigestAlgorithm(algType.getDigest());
         } else if (token instanceof X509Token || token instanceof KeyValueToken) {
             doSignature(token, wrapper);
         } else if (token instanceof SamlToken) {
             addSamlToken((SamlToken)token, false, true);
             signPartsAndElements(wrapper.getSignedParts(), wrapper.getSignedElements());
             
-            Map<String, Object> config = getProperties();
-            config.put(ConfigurationConstants.SIG_ALGO, 
+            WSSSecurityProperties properties = getProperties();
+            properties.setSignatureAlgorithm(
                        tbinding.getAlgorithmSuite().getAsymmetricSignature());
             AlgorithmSuiteType algType = tbinding.getAlgorithmSuite().getAlgorithmSuiteType();
-            config.put(ConfigurationConstants.SIG_DIGEST_ALGO, algType.getDigest());
+            properties.setSignatureDigestAlgorithm(algType.getDigest());
         } else if (token instanceof UsernameToken) {
             throw new Exception("Endorsing UsernameTokens are not supported in the streaming code");
         } else if (token instanceof KerberosToken) {
-            Map<String, Object> config = getProperties();
-            String signatureAction = ConfigurationConstants.SIGNATURE;
-            if (config.containsKey(ConfigurationConstants.ACTION)) {
-                String action = (String)config.get(ConfigurationConstants.ACTION);
-                config.put(ConfigurationConstants.ACTION, action + " " + signatureAction);
-            } else {
-                config.put(ConfigurationConstants.ACTION, signatureAction);
-            }
+            WSSSecurityProperties properties = getProperties();
+            properties.addAction(WSSConstants.SIGNATURE);
             configureSignature(wrapper, token, false);
             
             addKerberosToken((KerberosToken)token, false, true, false);
             signPartsAndElements(wrapper.getSignedParts(), wrapper.getSignedElements());
             
-            config.put(ConfigurationConstants.SIG_ALGO, 
+            properties.setSignatureAlgorithm(
                        tbinding.getAlgorithmSuite().getSymmetricSignature());
             AlgorithmSuiteType algType = tbinding.getAlgorithmSuite().getAlgorithmSuiteType();
-            config.put(ConfigurationConstants.SIG_DIGEST_ALGO, algType.getDigest());
+            properties.setSignatureDigestAlgorithm(algType.getDigest());
         }
     }
     
@@ -341,22 +336,16 @@ public class StaxTransportBindingHandler
         signPartsAndElements(wrapper.getSignedParts(), wrapper.getSignedElements());
         
         // Action
-        Map<String, Object> config = getProperties();
-        String actionToPerform = ConfigurationConstants.SIGNATURE;
+        WSSSecurityProperties properties = getProperties();
+        WSSConstants.Action actionToPerform = WSSConstants.SIGNATURE;
         if (token.getDerivedKeys() == DerivedKeys.RequireDerivedKeys) {
-            actionToPerform = ConfigurationConstants.SIGNATURE_DERIVED;
-        }
-        
-        if (config.containsKey(ConfigurationConstants.ACTION)) {
-            String action = (String)config.get(ConfigurationConstants.ACTION);
-            config.put(ConfigurationConstants.ACTION, action + " " + actionToPerform);
-        } else {
-            config.put(ConfigurationConstants.ACTION, actionToPerform);
+            actionToPerform = WSSConstants.SIGNATURE_WITH_DERIVED_KEY;
         }
+        properties.addAction(actionToPerform);
         
         configureSignature(wrapper, token, false);
         if (token.getDerivedKeys() == DerivedKeys.RequireDerivedKeys) {
-            config.put(ConfigurationConstants.SIG_ALGO, 
+            properties.setSignatureAlgorithm(
                    tbinding.getAlgorithmSuite().getSymmetricSignature());
         }
     }
@@ -368,36 +357,29 @@ public class StaxTransportBindingHandler
         SignedParts signedParts,
         SignedElements signedElements
     ) throws SOAPException {
-        Map<String, Object> properties = getProperties();
-        String parts = "";
-        if (properties.containsKey(ConfigurationConstants.SIGNATURE_PARTS)) {
-            parts = (String)properties.get(ConfigurationConstants.SIGNATURE_PARTS);
-            if (!parts.endsWith(";")) {
-                parts += ";";
-            }
-        }
-        
-        String optionalParts = "";
-        if (properties.containsKey(ConfigurationConstants.OPTIONAL_SIGNATURE_PARTS)) {
-            optionalParts = (String)properties.get(ConfigurationConstants.OPTIONAL_SIGNATURE_PARTS);
-            if (!optionalParts.endsWith(";")) {
-                optionalParts += ";";
-            }
-        }
+        WSSSecurityProperties properties = getProperties();
+        List<SecurePart> signatureParts = properties.getSignatureSecureParts();
         
         // Add timestamp
         if (timestampAdded) {
-            parts += "{Element}{" + WSSConstants.NS_WSU10 + "}Timestamp;";
+            SecurePart part = 
+                new SecurePart(new QName(WSSConstants.NS_WSU10, "Timestamp"), Modifier.Element);
+            signatureParts.add(part);
         }
 
         // Add SignedParts
         if (signedParts != null) {
             if (signedParts.isBody()) {
-                parts += "{Element}{" + WSSConstants.NS_SOAP11 + "}Body;";
+                SecurePart part = 
+                    new SecurePart(new QName(WSSConstants.NS_SOAP11, "Body"), Modifier.Element);
+                signatureParts.add(part);
             }
             
             for (Header head : signedParts.getHeaders()) {
-                optionalParts += "{Element}{" +  head.getNamespace() + "}" + head.getName() + ";";
+                SecurePart part = 
+                    new SecurePart(new QName(head.getNamespace(), head.getName()), Modifier.Element);
+                part.setRequired(false);
+                signatureParts.add(part);
             }
         }
         
@@ -406,13 +388,12 @@ public class StaxTransportBindingHandler
             for (XPath xPath : signedElements.getXPaths()) {
                 List<QName> qnames = PolicyUtils.getElementPath(xPath);
                 if (!qnames.isEmpty()) {
-                    parts += "{Element}" + qnames.get(qnames.size() - 1) + ";";
+                    SecurePart part = 
+                        new SecurePart(qnames.get(qnames.size() - 1), Modifier.Element);
+                    signatureParts.add(part);
                 }
             }
         }
-        
-        properties.put(ConfigurationConstants.SIGNATURE_PARTS, parts);
-        properties.put(ConfigurationConstants.OPTIONAL_SIGNATURE_PARTS, optionalParts);
     }
 
 

Modified: cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/DOMToStaxRoundTripTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/DOMToStaxRoundTripTest.java?rev=1548603&r1=1548602&r2=1548603&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/DOMToStaxRoundTripTest.java (original)
+++ cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/DOMToStaxRoundTripTest.java Fri Dec  6 17:17:19 2013
@@ -18,7 +18,9 @@
  */
 package org.apache.cxf.ws.security.wss4j;
 
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 
@@ -36,7 +38,6 @@ import org.apache.wss4j.dom.WSConstants;
 import org.apache.wss4j.dom.handler.WSHandlerConstants;
 import org.apache.wss4j.stax.ext.WSSConstants;
 import org.apache.wss4j.stax.ext.WSSSecurityProperties;
-import org.apache.xml.security.stax.ext.XMLSecurityConstants;
 import org.junit.Test;
 
 
@@ -513,11 +514,10 @@ public class DOMToStaxRoundTripTest exte
         service.getInInterceptors().add(inhandler);
         
         WSSSecurityProperties outProperties = new WSSSecurityProperties();
-        outProperties.setOutAction(
-            new XMLSecurityConstants.Action[] {
-                WSSConstants.SIGNATURE, WSSConstants.SIGNATURE_CONFIRMATION
-            }
-        );
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.SIGNATURE);
+        actions.add(WSSConstants.SIGNATURE_CONFIRMATION);
+        outProperties.setActions(actions);
         outProperties.setSignatureUser("myalias");
         
         Properties outCryptoProperties = 

Modified: cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/StaxCryptoCoverageCheckerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/StaxCryptoCoverageCheckerTest.java?rev=1548603&r1=1548602&r2=1548603&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/StaxCryptoCoverageCheckerTest.java (original)
+++ cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/StaxCryptoCoverageCheckerTest.java Fri Dec  6 17:17:19 2013
@@ -18,6 +18,8 @@
  */
 package org.apache.cxf.ws.security.wss4j;
 
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Properties;
 
 import javax.xml.namespace.QName;
@@ -35,7 +37,6 @@ import org.apache.wss4j.common.crypto.Cr
 import org.apache.wss4j.stax.ext.WSSConstants;
 import org.apache.wss4j.stax.ext.WSSSecurityProperties;
 import org.apache.xml.security.stax.ext.SecurePart;
-import org.apache.xml.security.stax.ext.XMLSecurityConstants;
 import org.junit.Test;
 
 
@@ -68,7 +69,9 @@ public class StaxCryptoCoverageCheckerTe
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.ENCRYPT});
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.ENCRYPT);
+        properties.setActions(actions);
         properties.setEncryptionUser("myalias");
         properties.setEncryptionSymAlgorithm(WSSConstants.NS_XENC_AES128);
         
@@ -116,7 +119,9 @@ public class StaxCryptoCoverageCheckerTe
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.USERNAMETOKEN});
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.USERNAMETOKEN);
+        properties.setActions(actions);
         properties.setUsernameTokenPasswordType(WSSConstants.UsernameTokenPasswordType.PASSWORD_TEXT);
         properties.setTokenUser("username");
         properties.setCallbackHandler(new TestPwdCallback());
@@ -160,9 +165,10 @@ public class StaxCryptoCoverageCheckerTe
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(
-            new XMLSecurityConstants.Action[]{WSSConstants.USERNAMETOKEN, WSSConstants.ENCRYPT}
-        );
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.USERNAMETOKEN);
+        actions.add(WSSConstants.ENCRYPT);
+        properties.setActions(actions);
         properties.addEncryptionPart(
             new SecurePart(new QName(WSSConstants.NS_WSSE10, "UsernameToken"), SecurePart.Modifier.Element)
         );
@@ -214,9 +220,10 @@ public class StaxCryptoCoverageCheckerTe
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[] {
-            WSSConstants.USERNAMETOKEN, WSSConstants.SIGNATURE
-        });
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.USERNAMETOKEN);
+        actions.add(WSSConstants.SIGNATURE);
+        properties.setActions(actions);
         properties.setSignatureUser("myalias");
         
         properties.addSignaturePart(
@@ -272,7 +279,9 @@ public class StaxCryptoCoverageCheckerTe
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.SIGNATURE});
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.SIGNATURE);
+        properties.setActions(actions);
         properties.setSignatureUser("myalias");
         
         Properties outCryptoProperties = 
@@ -314,7 +323,9 @@ public class StaxCryptoCoverageCheckerTe
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.TIMESTAMP});
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.TIMESTAMP);
+        properties.setActions(actions);
         
         WSS4JStaxOutInterceptor ohandler = new WSS4JStaxOutInterceptor(properties);
         client.getOutInterceptors().add(ohandler);
@@ -354,9 +365,10 @@ public class StaxCryptoCoverageCheckerTe
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(
-            new XMLSecurityConstants.Action[]{WSSConstants.TIMESTAMP, WSSConstants.SIGNATURE}
-        );
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.TIMESTAMP);
+        actions.add(WSSConstants.SIGNATURE);
+        properties.setActions(actions);
         properties.addSignaturePart(
             new SecurePart(new QName(WSSConstants.NS_WSU10, "Timestamp"), SecurePart.Modifier.Element)
         );
@@ -400,9 +412,10 @@ public class StaxCryptoCoverageCheckerTe
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(
-            new XMLSecurityConstants.Action[]{WSSConstants.ENCRYPT, WSSConstants.SIGNATURE}
-        );
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.ENCRYPT);
+        actions.add(WSSConstants.SIGNATURE);
+        properties.setActions(actions);
         properties.setEncryptionUser("myalias");
         properties.setSignatureUser("myalias");
         properties.setEncryptionSymAlgorithm(WSSConstants.NS_XENC_AES128);

Modified: cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/StaxRoundTripActionTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/StaxRoundTripActionTest.java?rev=1548603&r1=1548602&r2=1548603&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/StaxRoundTripActionTest.java (original)
+++ cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/StaxRoundTripActionTest.java Fri Dec  6 17:17:19 2013
@@ -40,7 +40,6 @@ import org.apache.wss4j.common.crypto.Cr
 import org.apache.wss4j.stax.ext.WSSConstants;
 import org.apache.wss4j.stax.ext.WSSSecurityProperties;
 import org.apache.xml.security.stax.ext.SecurePart;
-import org.apache.xml.security.stax.ext.XMLSecurityConstants;
 import org.junit.Test;
 
 /**
@@ -54,15 +53,14 @@ public class StaxRoundTripActionTest ext
         Service service = createService();
         
         WSSSecurityProperties inProperties = new WSSSecurityProperties();
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.USERNAMETOKEN);
+        inProperties.setActions(actions);
         inProperties.setCallbackHandler(new TestPwdCallback());
         WSS4JStaxInInterceptor inhandler = new WSS4JStaxInInterceptor(inProperties);
         WSS4JPrincipalInterceptor principalInterceptor = new WSS4JPrincipalInterceptor();
         principalInterceptor.setPrincipalName("username");
         
-        List<String> actions = new ArrayList<String>();
-        actions.add(WSSConstants.USERNAMETOKEN.getName());
-        inhandler.setActions(actions);
-        
         service.getInInterceptors().add(inhandler);
         service.getInInterceptors().add(principalInterceptor);
 
@@ -74,7 +72,9 @@ public class StaxRoundTripActionTest ext
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.USERNAMETOKEN});
+        actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.USERNAMETOKEN);
+        properties.setActions(actions);
         properties.setUsernameTokenPasswordType(WSSConstants.UsernameTokenPasswordType.PASSWORD_TEXT);
         properties.setTokenUser("username");
         properties.setCallbackHandler(new TestPwdCallback());
@@ -83,7 +83,10 @@ public class StaxRoundTripActionTest ext
 
         assertEquals("test", echo.echo("test"));
         
-        actions.add(WSSConstants.ENCRYPT.getName());
+        actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.USERNAMETOKEN);
+        actions.add(WSSConstants.ENCRYPT);
+        inProperties.setActions(actions);
         
         try {
             echo.echo("test");
@@ -119,7 +122,9 @@ public class StaxRoundTripActionTest ext
         client.getOutInterceptors().add(new LoggingOutInterceptor());
             
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.USERNAMETOKEN});
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.USERNAMETOKEN);
+        properties.setActions(actions);
         properties.setUsernameTokenPasswordType(WSSConstants.UsernameTokenPasswordType.PASSWORD_TEXT);
         properties.setTokenUser("username");
         properties.setCallbackHandler(new TestPwdCallback());
@@ -153,15 +158,14 @@ public class StaxRoundTripActionTest ext
         
         WSSSecurityProperties inProperties = new WSSSecurityProperties();
         inProperties.setCallbackHandler(new TestPwdCallback());
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.ENCRYPT);
+        inProperties.setActions(actions);
         Properties cryptoProperties = 
             CryptoFactory.getProperties("insecurity.properties", this.getClass().getClassLoader());
         inProperties.setDecryptionCryptoProperties(cryptoProperties);
         WSS4JStaxInInterceptor inhandler = new WSS4JStaxInInterceptor(inProperties);
         
-        List<String> actions = new ArrayList<String>();
-        actions.add(WSSConstants.ENCRYPT.getName());
-        inhandler.setActions(actions);
-        
         service.getInInterceptors().add(inhandler);
         
         // Create + configure client
@@ -172,7 +176,9 @@ public class StaxRoundTripActionTest ext
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.ENCRYPT});
+        actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.ENCRYPT);
+        properties.setActions(actions);
         properties.setEncryptionUser("myalias");
         properties.setEncryptionSymAlgorithm(WSSConstants.NS_XENC_AES128);
         
@@ -185,7 +191,10 @@ public class StaxRoundTripActionTest ext
 
         assertEquals("test", echo.echo("test"));
         
-        actions.add(WSSConstants.SIGNATURE.getName());
+        actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.ENCRYPT);
+        actions.add(WSSConstants.SIGNATURE);
+        inProperties.setActions(actions);
         
         try {
             echo.echo("test");
@@ -253,16 +262,15 @@ public class StaxRoundTripActionTest ext
         
         WSSSecurityProperties inProperties = new WSSSecurityProperties();
         inProperties.setCallbackHandler(new TestPwdCallback());
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.ENCRYPT);
+        actions.add(WSSConstants.USERNAMETOKEN);
+        inProperties.setActions(actions);
         Properties cryptoProperties = 
             CryptoFactory.getProperties("insecurity.properties", this.getClass().getClassLoader());
         inProperties.setDecryptionCryptoProperties(cryptoProperties);
         WSS4JStaxInInterceptor inhandler = new WSS4JStaxInInterceptor(inProperties);
         
-        List<String> actions = new ArrayList<String>();
-        actions.add(WSSConstants.ENCRYPT.getName());
-        actions.add(WSSConstants.USERNAMETOKEN.getName());
-        inhandler.setActions(actions);
-        
         service.getInInterceptors().add(inhandler);
         
         // Create + configure client
@@ -273,9 +281,10 @@ public class StaxRoundTripActionTest ext
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(
-            new XMLSecurityConstants.Action[]{WSSConstants.USERNAMETOKEN, WSSConstants.ENCRYPT}
-        );
+        actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.USERNAMETOKEN);
+        actions.add(WSSConstants.ENCRYPT);
+        properties.setActions(actions);
         properties.addEncryptionPart(
             new SecurePart(new QName(WSSConstants.NS_WSSE10, "UsernameToken"), SecurePart.Modifier.Element)
         );
@@ -345,15 +354,14 @@ public class StaxRoundTripActionTest ext
         inProperties.setCallbackHandler(new TestPwdCallback());
         Properties cryptoProperties = 
             CryptoFactory.getProperties("insecurity.properties", this.getClass().getClassLoader());
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.SIGNATURE);
+        inProperties.setActions(actions);
         inProperties.setSignatureVerificationCryptoProperties(cryptoProperties);
         WSS4JStaxInInterceptor inhandler = new WSS4JStaxInInterceptor(inProperties);
         WSS4JPrincipalInterceptor principalInterceptor = new WSS4JPrincipalInterceptor();
         principalInterceptor.setPrincipalName("CN=myAlias");
         
-        List<String> actions = new ArrayList<String>();
-        actions.add(WSSConstants.SIGNATURE.getName());
-        inhandler.setActions(actions);
-        
         service.getInInterceptors().add(inhandler);
         service.getInInterceptors().add(principalInterceptor);
         
@@ -365,7 +373,9 @@ public class StaxRoundTripActionTest ext
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.SIGNATURE});
+        actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.SIGNATURE);
+        properties.setActions(actions);
         properties.setSignatureUser("myalias");
         
         Properties outCryptoProperties = 
@@ -377,7 +387,10 @@ public class StaxRoundTripActionTest ext
 
         assertEquals("test", echo.echo("test"));
         
-        actions.add(WSSConstants.ENCRYPT.getName());
+        actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.SIGNATURE);
+        actions.add(WSSConstants.ENCRYPT);
+        inProperties.setActions(actions);
         
         try {
             echo.echo("test");
@@ -446,12 +459,11 @@ public class StaxRoundTripActionTest ext
         Service service = createService();
         
         WSSSecurityProperties inProperties = new WSSSecurityProperties();
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.TIMESTAMP);
+        inProperties.setActions(actions);
         WSS4JStaxInInterceptor inhandler = new WSS4JStaxInInterceptor(inProperties);
         
-        List<String> actions = new ArrayList<String>();
-        actions.add(WSSConstants.TIMESTAMP.getName());
-        inhandler.setActions(actions);
-        
         service.getInInterceptors().add(inhandler);
         
         // Create + configure client
@@ -462,7 +474,9 @@ public class StaxRoundTripActionTest ext
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.TIMESTAMP});
+        actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.TIMESTAMP);
+        properties.setActions(actions);
         
         WSS4JStaxOutInterceptor ohandler = new WSS4JStaxOutInterceptor(properties);
         client.getOutInterceptors().add(ohandler);
@@ -504,16 +518,15 @@ public class StaxRoundTripActionTest ext
         
         WSSSecurityProperties inProperties = new WSSSecurityProperties();
         inProperties.setCallbackHandler(new TestPwdCallback());
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.TIMESTAMP);
+        actions.add(WSSConstants.SIGNATURE);
+        inProperties.setActions(actions);
         Properties cryptoProperties = 
             CryptoFactory.getProperties("insecurity.properties", this.getClass().getClassLoader());
         inProperties.setSignatureVerificationCryptoProperties(cryptoProperties);
         WSS4JStaxInInterceptor inhandler = new WSS4JStaxInInterceptor(inProperties);
         
-        List<String> actions = new ArrayList<String>();
-        actions.add(WSSConstants.TIMESTAMP.getName());
-        actions.add(WSSConstants.SIGNATURE.getName());
-        inhandler.setActions(actions);
-        
         service.getInInterceptors().add(inhandler);
         
         // Create + configure client
@@ -524,9 +537,10 @@ public class StaxRoundTripActionTest ext
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(
-            new XMLSecurityConstants.Action[]{WSSConstants.TIMESTAMP, WSSConstants.SIGNATURE}
-        );
+        actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.TIMESTAMP);
+        actions.add(WSSConstants.SIGNATURE);
+        properties.setActions(actions);
         properties.addSignaturePart(
             new SecurePart(new QName(WSSConstants.NS_WSU10, "Timestamp"), SecurePart.Modifier.Element)
         );
@@ -594,17 +608,16 @@ public class StaxRoundTripActionTest ext
         
         WSSSecurityProperties inProperties = new WSSSecurityProperties();
         inProperties.setCallbackHandler(new TestPwdCallback());
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.ENCRYPT);
+        actions.add(WSSConstants.SIGNATURE);
+        inProperties.setActions(actions);
         Properties cryptoProperties = 
             CryptoFactory.getProperties("insecurity.properties", this.getClass().getClassLoader());
         inProperties.setSignatureVerificationCryptoProperties(cryptoProperties);
         inProperties.setDecryptionCryptoProperties(cryptoProperties);
         WSS4JStaxInInterceptor inhandler = new WSS4JStaxInInterceptor(inProperties);
         
-        List<String> actions = new ArrayList<String>();
-        actions.add(WSSConstants.ENCRYPT.getName());
-        actions.add(WSSConstants.SIGNATURE.getName());
-        inhandler.setActions(actions);
-        
         service.getInInterceptors().add(inhandler);
         
         // Create + configure client
@@ -615,9 +628,10 @@ public class StaxRoundTripActionTest ext
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(
-            new XMLSecurityConstants.Action[]{WSSConstants.ENCRYPT, WSSConstants.SIGNATURE}
-        );
+        actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.ENCRYPT);
+        actions.add(WSSConstants.SIGNATURE);
+        properties.setActions(actions);
         properties.setEncryptionUser("myalias");
         properties.setSignatureUser("myalias");
         properties.setEncryptionSymAlgorithm(WSSConstants.NS_XENC_AES128);

Modified: cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/StaxRoundTripTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/StaxRoundTripTest.java?rev=1548603&r1=1548602&r2=1548603&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/StaxRoundTripTest.java (original)
+++ cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/StaxRoundTripTest.java Fri Dec  6 17:17:19 2013
@@ -19,7 +19,9 @@
 package org.apache.cxf.ws.security.wss4j;
 
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 
@@ -44,7 +46,6 @@ import org.apache.wss4j.stax.ext.WSSCons
 import org.apache.wss4j.stax.ext.WSSSecurityProperties;
 import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants;
 import org.apache.xml.security.stax.ext.SecurePart;
-import org.apache.xml.security.stax.ext.XMLSecurityConstants;
 import org.junit.Test;
 
 
@@ -74,7 +75,9 @@ public class StaxRoundTripTest extends A
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.USERNAMETOKEN});
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.USERNAMETOKEN);
+        properties.setActions(actions);
         properties.setUsernameTokenPasswordType(WSSConstants.UsernameTokenPasswordType.PASSWORD_TEXT);
         properties.setTokenUser("username");
         properties.setCallbackHandler(new TestPwdCallback());
@@ -166,7 +169,9 @@ public class StaxRoundTripTest extends A
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.USERNAMETOKEN});
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.USERNAMETOKEN);
+        properties.setActions(actions);
         properties.setUsernameTokenPasswordType(WSSConstants.UsernameTokenPasswordType.PASSWORD_TEXT);
         properties.setTokenUser("Alice");
         properties.setCallbackHandler(new UnknownUserPasswordCallbackHandler());
@@ -202,7 +207,9 @@ public class StaxRoundTripTest extends A
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.USERNAMETOKEN});
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.USERNAMETOKEN);
+        properties.setActions(actions);
         properties.setUsernameTokenPasswordType(WSSConstants.UsernameTokenPasswordType.PASSWORD_TEXT);
         properties.setTokenUser("username");
         properties.setCallbackHandler(new UnknownUserPasswordCallbackHandler());
@@ -241,7 +248,9 @@ public class StaxRoundTripTest extends A
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.USERNAMETOKEN});
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.USERNAMETOKEN);
+        properties.setActions(actions);
         properties.setUsernameTokenPasswordType(WSSConstants.UsernameTokenPasswordType.PASSWORD_DIGEST);
         properties.setTokenUser("username");
         properties.setCallbackHandler(new TestPwdCallback());
@@ -333,7 +342,9 @@ public class StaxRoundTripTest extends A
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.USERNAMETOKEN});
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.USERNAMETOKEN);
+        properties.setActions(actions);
         properties.setUsernameTokenPasswordType(WSSConstants.UsernameTokenPasswordType.PASSWORD_DIGEST);
         properties.setTokenUser("Alice");
         properties.setCallbackHandler(new UnknownUserPasswordCallbackHandler());
@@ -369,7 +380,9 @@ public class StaxRoundTripTest extends A
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.USERNAMETOKEN});
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.USERNAMETOKEN);
+        properties.setActions(actions);
         properties.setUsernameTokenPasswordType(WSSConstants.UsernameTokenPasswordType.PASSWORD_DIGEST);
         properties.setTokenUser("username");
         properties.setCallbackHandler(new UnknownUserPasswordCallbackHandler());
@@ -407,7 +420,9 @@ public class StaxRoundTripTest extends A
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.ENCRYPT});
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.ENCRYPT);
+        properties.setActions(actions);
         properties.setEncryptionSymAlgorithm(WSSConstants.NS_XENC_AES128);
         properties.setEncryptionUser("myalias");
         
@@ -473,9 +488,10 @@ public class StaxRoundTripTest extends A
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(
-            new XMLSecurityConstants.Action[]{WSSConstants.USERNAMETOKEN, WSSConstants.ENCRYPT}
-        );
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.USERNAMETOKEN);
+        actions.add(WSSConstants.ENCRYPT);
+        properties.setActions(actions);
         properties.addEncryptionPart(
             new SecurePart(new QName(WSSConstants.NS_WSSE10, "UsernameToken"), SecurePart.Modifier.Element)
         );
@@ -556,7 +572,9 @@ public class StaxRoundTripTest extends A
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.SIGNATURE});
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.SIGNATURE);
+        properties.setActions(actions);
         properties.setSignatureUser("myalias");
         
         Properties outCryptoProperties = 
@@ -627,9 +645,10 @@ public class StaxRoundTripTest extends A
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[] {
-            WSSConstants.USERNAMETOKEN, WSSConstants.SIGNATURE
-        });
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.USERNAMETOKEN);
+        actions.add(WSSConstants.SIGNATURE);
+        properties.setActions(actions);
         properties.setSignatureUser("myalias");
         
         properties.addSignaturePart(
@@ -709,7 +728,9 @@ public class StaxRoundTripTest extends A
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.TIMESTAMP});
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.TIMESTAMP);
+        properties.setActions(actions);
         
         WSS4JStaxOutInterceptor ohandler = new WSS4JStaxOutInterceptor(properties);
         client.getOutInterceptors().add(ohandler);
@@ -763,9 +784,10 @@ public class StaxRoundTripTest extends A
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(
-            new XMLSecurityConstants.Action[]{WSSConstants.TIMESTAMP, WSSConstants.SIGNATURE}
-        );
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.TIMESTAMP);
+        actions.add(WSSConstants.SIGNATURE);
+        properties.setActions(actions);
         properties.addSignaturePart(
             new SecurePart(new QName(WSSConstants.NS_WSU10, "Timestamp"), SecurePart.Modifier.Element)
         );
@@ -846,9 +868,9 @@ public class StaxRoundTripTest extends A
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(
-            new XMLSecurityConstants.Action[]{WSSConstants.SIGNATURE}
-        );
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.SIGNATURE);
+        properties.setActions(actions);
         properties.setSignatureUser("alice");
         
         Properties outCryptoProperties = 
@@ -923,9 +945,10 @@ public class StaxRoundTripTest extends A
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(
-            new XMLSecurityConstants.Action[]{WSSConstants.ENCRYPT, WSSConstants.SIGNATURE}
-        );
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.ENCRYPT);
+        actions.add(WSSConstants.SIGNATURE);
+        properties.setActions(actions);
         properties.setEncryptionUser("myalias");
         properties.setSignatureUser("myalias");
         properties.setEncryptionSymAlgorithm(WSSConstants.NS_XENC_AES128);
@@ -992,11 +1015,10 @@ public class StaxRoundTripTest extends A
         service.getInInterceptors().add(inhandler);
         
         WSSSecurityProperties outProperties = new WSSSecurityProperties();
-        outProperties.setOutAction(
-            new XMLSecurityConstants.Action[] {
-                WSSConstants.SIGNATURE, WSSConstants.SIGNATURE_CONFIRMATION
-            }
-        );
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.SIGNATURE);
+        actions.add(WSSConstants.SIGNATURE_CONFIRMATION);
+        outProperties.setActions(actions);
         outProperties.setSignatureUser("myalias");
         
         Properties outCryptoProperties = 
@@ -1014,7 +1036,9 @@ public class StaxRoundTripTest extends A
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.SIGNATURE});
+        actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.SIGNATURE);
+        properties.setActions(actions);
         properties.setSignatureUser("myalias");
         
         Properties clientOutCryptoProperties = 

Modified: cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/StaxToDOMEncryptionIdentifierTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/StaxToDOMEncryptionIdentifierTest.java?rev=1548603&r1=1548602&r2=1548603&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/StaxToDOMEncryptionIdentifierTest.java (original)
+++ cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/StaxToDOMEncryptionIdentifierTest.java Fri Dec  6 17:17:19 2013
@@ -18,7 +18,9 @@
  */
 package org.apache.cxf.ws.security.wss4j;
 
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 
@@ -36,7 +38,6 @@ import org.apache.wss4j.dom.handler.WSHa
 import org.apache.wss4j.stax.ext.WSSConstants;
 import org.apache.wss4j.stax.ext.WSSSecurityProperties;
 import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants;
-import org.apache.xml.security.stax.ext.XMLSecurityConstants;
 import org.junit.Test;
 
 
@@ -66,7 +67,9 @@ public class StaxToDOMEncryptionIdentifi
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.ENCRYPT});
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.ENCRYPT);
+        properties.setActions(actions);
         properties.setEncryptionUser("myalias");
         properties.setEncryptionKeyIdentifier(
             WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference
@@ -103,7 +106,9 @@ public class StaxToDOMEncryptionIdentifi
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.ENCRYPT});
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.ENCRYPT);
+        properties.setActions(actions);
         properties.setEncryptionUser("myalias");
         properties.setEncryptionKeyIdentifier(
             WSSecurityTokenConstants.KeyIdentifier_IssuerSerial
@@ -140,7 +145,9 @@ public class StaxToDOMEncryptionIdentifi
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.ENCRYPT});
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.ENCRYPT);
+        properties.setActions(actions);
         properties.setEncryptionUser("myalias");
         properties.setEncryptionKeyIdentifier(
             WSSecurityTokenConstants.KeyIdentifier_ThumbprintIdentifier
@@ -178,7 +185,9 @@ public class StaxToDOMEncryptionIdentifi
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.ENCRYPT});
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.ENCRYPT);
+        properties.setActions(actions);
         properties.setEncryptionUser("myalias");
         properties.setEncryptionKeyIdentifier(
             WSSecurityTokenConstants.KeyIdentifier_X509KeyIdentifier
@@ -215,7 +224,9 @@ public class StaxToDOMEncryptionIdentifi
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.ENCRYPT});
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.ENCRYPT);
+        properties.setActions(actions);
         properties.setEncryptionUser("myalias");
         properties.setEncryptionKeyIdentifier(
             WSSecurityTokenConstants.KeyIdentifier_EncryptedKeySha1Identifier

Modified: cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/StaxToDOMRoundTripTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/StaxToDOMRoundTripTest.java?rev=1548603&r1=1548602&r2=1548603&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/StaxToDOMRoundTripTest.java (original)
+++ cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/StaxToDOMRoundTripTest.java Fri Dec  6 17:17:19 2013
@@ -18,7 +18,9 @@
  */
 package org.apache.cxf.ws.security.wss4j;
 
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 
@@ -41,7 +43,6 @@ import org.apache.wss4j.stax.ext.WSSCons
 import org.apache.wss4j.stax.ext.WSSSecurityProperties;
 import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants;
 import org.apache.xml.security.stax.ext.SecurePart;
-import org.apache.xml.security.stax.ext.XMLSecurityConstants;
 import org.junit.Test;
 
 
@@ -70,7 +71,9 @@ public class StaxToDOMRoundTripTest exte
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.USERNAMETOKEN});
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.USERNAMETOKEN);
+        properties.setActions(actions);
         properties.setUsernameTokenPasswordType(WSSConstants.UsernameTokenPasswordType.PASSWORD_TEXT);
         properties.setTokenUser("username");
         properties.setCallbackHandler(new TestPwdCallback());
@@ -162,7 +165,9 @@ public class StaxToDOMRoundTripTest exte
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.USERNAMETOKEN});
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.USERNAMETOKEN);
+        properties.setActions(actions);
         properties.setUsernameTokenPasswordType(WSSConstants.UsernameTokenPasswordType.PASSWORD_DIGEST);
         properties.setTokenUser("username");
         properties.setCallbackHandler(new TestPwdCallback());
@@ -253,7 +258,9 @@ public class StaxToDOMRoundTripTest exte
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.ENCRYPT});
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.ENCRYPT);
+        properties.setActions(actions);
         properties.setEncryptionUser("myalias");
         properties.setEncryptionSymAlgorithm(WSSConstants.NS_XENC_AES128);
         
@@ -319,7 +326,9 @@ public class StaxToDOMRoundTripTest exte
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.ENCRYPT});
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.ENCRYPT);
+        properties.setActions(actions);
         properties.setEncryptionUser("myalias");
         
         Properties cryptoProperties = 
@@ -413,9 +422,10 @@ public class StaxToDOMRoundTripTest exte
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(
-            new XMLSecurityConstants.Action[]{WSSConstants.USERNAMETOKEN, WSSConstants.ENCRYPT}
-        );
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.USERNAMETOKEN);
+        actions.add(WSSConstants.ENCRYPT);
+        properties.setActions(actions);
         properties.addEncryptionPart(
             new SecurePart(new QName(WSSConstants.NS_WSSE10, "UsernameToken"), SecurePart.Modifier.Element)
         );
@@ -496,7 +506,9 @@ public class StaxToDOMRoundTripTest exte
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.SIGNATURE});
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.SIGNATURE);
+        properties.setActions(actions);
         properties.setSignatureUser("myalias");
         
         Properties cryptoProperties = 
@@ -563,9 +575,10 @@ public class StaxToDOMRoundTripTest exte
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[] {
-            WSSConstants.USERNAMETOKEN, WSSConstants.SIGNATURE
-        });
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.USERNAMETOKEN);
+        actions.add(WSSConstants.SIGNATURE);
+        properties.setActions(actions);
         properties.setSignatureUser("myalias");
         
         properties.addSignaturePart(
@@ -647,7 +660,9 @@ public class StaxToDOMRoundTripTest exte
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.TIMESTAMP});
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.TIMESTAMP);
+        properties.setActions(actions);
         
         WSS4JStaxOutInterceptor ohandler = new WSS4JStaxOutInterceptor(properties);
         client.getOutInterceptors().add(ohandler);
@@ -734,9 +749,10 @@ public class StaxToDOMRoundTripTest exte
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(
-            new XMLSecurityConstants.Action[]{WSSConstants.TIMESTAMP, WSSConstants.SIGNATURE}
-        );
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.TIMESTAMP);
+        actions.add(WSSConstants.SIGNATURE);
+        properties.setActions(actions);
         properties.addSignaturePart(
             new SecurePart(new QName(WSSConstants.NS_WSU10, "Timestamp"), SecurePart.Modifier.Element)
         );
@@ -820,9 +836,10 @@ public class StaxToDOMRoundTripTest exte
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(
-            new XMLSecurityConstants.Action[]{WSSConstants.SIGNATURE, WSSConstants.TIMESTAMP}
-        );
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.SIGNATURE);
+        actions.add(WSSConstants.TIMESTAMP);
+        properties.setActions(actions);
         properties.addSignaturePart(
             new SecurePart(new QName(WSSConstants.NS_WSSE10, "Timestamp"), SecurePart.Modifier.Element)
         );
@@ -866,9 +883,9 @@ public class StaxToDOMRoundTripTest exte
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(
-            new XMLSecurityConstants.Action[]{WSSConstants.SIGNATURE}
-        );
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.SIGNATURE);
+        properties.setActions(actions);
         properties.setSignatureUser("alice");
         
         Properties cryptoProperties = 
@@ -943,9 +960,10 @@ public class StaxToDOMRoundTripTest exte
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(
-            new XMLSecurityConstants.Action[]{WSSConstants.ENCRYPT, WSSConstants.SIGNATURE}
-        );
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.ENCRYPT);
+        actions.add(WSSConstants.SIGNATURE);
+        properties.setActions(actions);
         properties.setEncryptionUser("myalias");
         properties.setSignatureUser("myalias");
         properties.setEncryptionSymAlgorithm(WSSConstants.NS_XENC_AES128);
@@ -1032,7 +1050,9 @@ public class StaxToDOMRoundTripTest exte
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.SIGNATURE});
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.SIGNATURE);
+        properties.setActions(actions);
         properties.setSignatureUser("myalias");
         
         Properties cryptoProperties = 

Modified: cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/StaxToDOMSignatureIdentifierTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/StaxToDOMSignatureIdentifierTest.java?rev=1548603&r1=1548602&r2=1548603&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/StaxToDOMSignatureIdentifierTest.java (original)
+++ cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/StaxToDOMSignatureIdentifierTest.java Fri Dec  6 17:17:19 2013
@@ -18,7 +18,9 @@
  */
 package org.apache.cxf.ws.security.wss4j;
 
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 
@@ -36,7 +38,6 @@ import org.apache.wss4j.dom.handler.WSHa
 import org.apache.wss4j.stax.ext.WSSConstants;
 import org.apache.wss4j.stax.ext.WSSSecurityProperties;
 import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants;
-import org.apache.xml.security.stax.ext.XMLSecurityConstants;
 import org.junit.Test;
 
 
@@ -66,7 +67,9 @@ public class StaxToDOMSignatureIdentifie
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.SIGNATURE});
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.SIGNATURE);
+        properties.setActions(actions);
         properties.setSignatureKeyIdentifier(
             WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference
         );
@@ -102,7 +105,9 @@ public class StaxToDOMSignatureIdentifie
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.SIGNATURE});
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.SIGNATURE);
+        properties.setActions(actions);
         properties.setSignatureKeyIdentifier(
             WSSecurityTokenConstants.KeyIdentifier_IssuerSerial
         );
@@ -138,7 +143,9 @@ public class StaxToDOMSignatureIdentifie
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.SIGNATURE});
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.SIGNATURE);
+        properties.setActions(actions);
         properties.setSignatureKeyIdentifier(
             WSSecurityTokenConstants.KeyIdentifier_ThumbprintIdentifier
         );
@@ -175,7 +182,9 @@ public class StaxToDOMSignatureIdentifie
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.SIGNATURE});
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.SIGNATURE);
+        properties.setActions(actions);
         properties.setSignatureKeyIdentifier(
             WSSecurityTokenConstants.KeyIdentifier_X509KeyIdentifier
         );
@@ -212,7 +221,9 @@ public class StaxToDOMSignatureIdentifie
         client.getOutInterceptors().add(new LoggingOutInterceptor());
         
         WSSSecurityProperties properties = new WSSSecurityProperties();
-        properties.setOutAction(new XMLSecurityConstants.Action[]{WSSConstants.SIGNATURE});
+        List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
+        actions.add(WSSConstants.SIGNATURE);
+        properties.setActions(actions);
         properties.setSignatureKeyIdentifier(
             WSSecurityTokenConstants.KeyIdentifier_KeyValue
         );



Mime
View raw message