You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2013/10/04 12:43:38 UTC

svn commit: r1529127 - in /cxf/trunk: rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/ systests/ws-security-examples/src/test/resources/org/apache/cxf/systest/wssec/examples/ut/

Author: coheigea
Date: Fri Oct  4 10:43:37 2013
New Revision: 1529127

URL: http://svn.apache.org/r1529127
Log:
Fixing some "Strict" ordering streaming security tests

Modified:
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxAsymmetricBindingHandler.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxSymmetricBindingHandler.java
    cxf/trunk/systests/ws-security-examples/src/test/resources/org/apache/cxf/systest/wssec/examples/ut/DoubleItUt.wsdl

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxAsymmetricBindingHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxAsymmetricBindingHandler.java?rev=1529127&r1=1529126&r2=1529127&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxAsymmetricBindingHandler.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxAsymmetricBindingHandler.java Fri Oct  4 10:43:37 2013
@@ -112,15 +112,6 @@ public class StaxAsymmetricBindingHandle
                             attached = true;
                         } 
                     }
-                } else if (initiatorToken instanceof SamlToken) {
-                    SamlAssertionWrapper assertionWrapper = addSamlToken((SamlToken)initiatorToken);
-                    if (assertionWrapper != null) {
-                        if (includeToken(initiatorToken.getIncludeTokenType())) {
-                            addSupportingElement(assertionWrapper.toDOM(saaj.getSOAPPart()));
-                            storeAssertionAsSecurityToken(assertionWrapper);
-                        }
-                        policyAsserted(initiatorToken);
-                    }
                 }
             }
             */
@@ -133,7 +124,6 @@ public class StaxAsymmetricBindingHandle
                 sigs.add(part);
             }
             sigs.addAll(this.getSignedParts());
-            addSupportingTokens();
             
             if (isRequestor() && initiatorWrapper != null) {
                 doSignature(initiatorWrapper, sigs);
@@ -151,6 +141,18 @@ public class StaxAsymmetricBindingHandle
                 }
             }
             
+            addSupportingTokens();
+            
+            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);
+                }
+            } 
+            
             List<SecurePart> enc = getEncryptedParts();
             
             //Check for signature protection
@@ -227,21 +229,6 @@ public class StaxAsymmetricBindingHandle
                             attached = true;
                         } 
                     }
-                } else if (initiatorToken instanceof SamlToken) {
-                    try {
-                        SamlAssertionWrapper assertionWrapper = addSamlToken((SamlToken)initiatorToken);
-                        if (assertionWrapper != null) {
-                            if (includeToken(initiatorToken.getIncludeTokenType())) {
-                                addSupportingElement(assertionWrapper.toDOM(saaj.getSOAPPart()));
-                                storeAssertionAsSecurityToken(assertionWrapper);
-                            }
-                            policyAsserted(initiatorToken);
-                        }
-                    } catch (Exception e) {
-                        String reason = e.getMessage();
-                        LOG.log(Level.FINE, "Encrypt before sign failed due to : " + reason);
-                        throw new Fault(e);
-                    }
                 }
             }
             */
@@ -375,9 +362,7 @@ public class StaxAsymmetricBindingHandle
         
         if (config.containsKey(ConfigurationConstants.ACTION)) {
             String action = (String)config.get(ConfigurationConstants.ACTION);
-            if (!action.contains(ConfigurationConstants.SAML_TOKEN_SIGNED)) {
-                config.put(ConfigurationConstants.ACTION, action + " " + actionToPerform);
-            }
+            config.put(ConfigurationConstants.ACTION, action + " " + actionToPerform);
         } else {
             config.put(ConfigurationConstants.ACTION, actionToPerform);
         }

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=1529127&r1=1529126&r2=1529127&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 Oct  4 10:43:37 2013
@@ -293,7 +293,6 @@ public class StaxSymmetricBindingHandler
             sigs.addAll(this.getSignedParts());
 
             if (isRequestor()) {
-                addSupportingTokens();
                 if (!sigs.isEmpty()) {
                     doSignature(sigAbstractTokenWrapper, sigToken, sigTok, sigs);
                 }
@@ -304,6 +303,20 @@ public class StaxSymmetricBindingHandler
                     doSignature(sigAbstractTokenWrapper, sigToken, sigTok, sigs);
                 }
             }
+            
+            if (isRequestor()) {
+                addSupportingTokens();
+                
+                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);
+                    }
+                } 
+            }
 
             //Encryption
             List<SecurePart> enc = getEncryptedParts();
@@ -402,9 +415,7 @@ public class StaxSymmetricBindingHandler
         
         if (config.containsKey(ConfigurationConstants.ACTION)) {
             String action = (String)config.get(ConfigurationConstants.ACTION);
-            if (!action.contains(ConfigurationConstants.SAML_TOKEN_SIGNED)) {
-                config.put(ConfigurationConstants.ACTION, action + " " + actionToPerform);
-            }
+            config.put(ConfigurationConstants.ACTION, action + " " + actionToPerform);
         } else {
             config.put(ConfigurationConstants.ACTION, actionToPerform);
         }

Modified: cxf/trunk/systests/ws-security-examples/src/test/resources/org/apache/cxf/systest/wssec/examples/ut/DoubleItUt.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security-examples/src/test/resources/org/apache/cxf/systest/wssec/examples/ut/DoubleItUt.wsdl?rev=1529127&r1=1529126&r2=1529127&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security-examples/src/test/resources/org/apache/cxf/systest/wssec/examples/ut/DoubleItUt.wsdl (original)
+++ cxf/trunk/systests/ws-security-examples/src/test/resources/org/apache/cxf/systest/wssec/examples/ut/DoubleItUt.wsdl Fri Oct  4 10:43:37 2013
@@ -291,8 +291,7 @@
                   </sp:AlgorithmSuite>
                   <sp:Layout>
                      <wsp:Policy>
-                        <!--<sp:Strict/>-->
-                        <sp:Lax/>
+                        <sp:Strict/>
                      </wsp:Policy>
                   </sp:Layout>
                   <sp:IncludeTimestamp/>
@@ -401,8 +400,7 @@
                         </sp:AlgorithmSuite>
                         <sp:Layout>
                             <wsp:Policy>
-                                <!--<sp:Strict/>-->
-                                <sp:Lax/>
+                                <sp:Strict/>
                             </wsp:Policy>
                         </sp:Layout>
                         <sp:IncludeTimestamp/>