cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1455187 - in /cxf/branches/wss4j2.0-port: rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/ systests/ws-security/src/test/java/org/apache/cxf/systest/ws/wssec11/ systests/ws-security/src/test/resources/
Date Mon, 11 Mar 2013 15:35:07 GMT
Author: coheigea
Date: Mon Mar 11 15:35:06 2013
New Revision: 1455187

URL: http://svn.apache.org/r1455187
Log:
Fixed some more failing tests

Removed:
    cxf/branches/wss4j2.0-port/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/wssec11/RestrictedAlgorithmSuite.java
Modified:
    cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/AbstractBindingPolicyValidator.java
    cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/AsymmetricBindingPolicyValidator.java
    cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/SymmetricBindingPolicyValidator.java
    cxf/branches/wss4j2.0-port/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/wssec11/RestrictedAlgorithmSuiteLoader.java
    cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/logging.properties

Modified: cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/AbstractBindingPolicyValidator.java
URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/AbstractBindingPolicyValidator.java?rev=1455187&r1=1455186&r2=1455187&view=diff
==============================================================================
--- cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/AbstractBindingPolicyValidator.java
(original)
+++ cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/AbstractBindingPolicyValidator.java
Mon Mar 11 15:35:06 2013
@@ -241,18 +241,23 @@ public abstract class AbstractBindingPol
      */
     protected boolean checkProtectionOrder(
         AbstractSymmetricAsymmetricBinding binding, 
+        AssertionInfoMap aim,
         AssertionInfo ai,
         List<WSSecurityEngineResult> results
     ) {
         ProtectionOrder protectionOrder = binding.getProtectionOrder();
-        if (protectionOrder == ProtectionOrder.SignBeforeEncrypting) {
+        if (protectionOrder == ProtectionOrder.EncryptBeforeSigning) {
             if (!binding.isProtectTokens() && isSignedBeforeEncrypted(results)) {
                 ai.setNotAsserted("Not encrypted before signed");
                 return false;
             }
-        } else if (isEncryptedBeforeSigned(results)) {
-            ai.setNotAsserted("Not signed before encrypted");
-            return false;
+            assertPolicy(aim, SP12Constants.ENCRYPT_BEFORE_SIGNING);
+        } else if (protectionOrder == ProtectionOrder.SignBeforeEncrypting) { 
+            if (isEncryptedBeforeSigned(results)) {
+                ai.setNotAsserted("Not signed before encrypted");
+                return false;
+            }
+            assertPolicy(aim, SP12Constants.SIGN_BEFORE_ENCRYPTING);
         }
         return true;
     }

Modified: cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/AsymmetricBindingPolicyValidator.java
URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/AsymmetricBindingPolicyValidator.java?rev=1455187&r1=1455186&r2=1455187&view=diff
==============================================================================
--- cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/AsymmetricBindingPolicyValidator.java
(original)
+++ cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/AsymmetricBindingPolicyValidator.java
Mon Mar 11 15:35:06 2013
@@ -68,7 +68,7 @@ public class AsymmetricBindingPolicyVali
             ai.setAsserted(true);
 
             // Check the protection order
-            if (!checkProtectionOrder(binding, ai, results)) {
+            if (!checkProtectionOrder(binding, aim, ai, results)) {
                 continue;
             }
             

Modified: cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/SymmetricBindingPolicyValidator.java
URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/SymmetricBindingPolicyValidator.java?rev=1455187&r1=1455186&r2=1455187&view=diff
==============================================================================
--- cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/SymmetricBindingPolicyValidator.java
(original)
+++ cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/SymmetricBindingPolicyValidator.java
Mon Mar 11 15:35:06 2013
@@ -64,7 +64,7 @@ public class SymmetricBindingPolicyValid
             ai.setAsserted(true);
 
             // Check the protection order
-            if (!checkProtectionOrder(binding, ai, results)) {
+            if (!checkProtectionOrder(binding, aim, ai, results)) {
                 continue;
             }
             

Modified: cxf/branches/wss4j2.0-port/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/wssec11/RestrictedAlgorithmSuiteLoader.java
URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/wssec11/RestrictedAlgorithmSuiteLoader.java?rev=1455187&r1=1455186&r2=1455187&view=diff
==============================================================================
--- cxf/branches/wss4j2.0-port/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/wssec11/RestrictedAlgorithmSuiteLoader.java
(original)
+++ cxf/branches/wss4j2.0-port/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/wssec11/RestrictedAlgorithmSuiteLoader.java
Mon Mar 11 15:35:06 2013
@@ -18,13 +18,13 @@
  */
 package org.apache.cxf.systest.ws.wssec11;
 
-import org.w3c.dom.Element;
-
 import org.apache.cxf.Bus;
-import org.apache.cxf.helpers.DOMUtils;
-import org.apache.cxf.ws.security.policy.SPConstants;
 import org.apache.cxf.ws.security.policy.custom.AlgorithmSuiteLoader;
-import org.apache.cxf.ws.security.policy.model.AlgorithmSuite;
+import org.apache.neethi.Assertion;
+import org.apache.neethi.Policy;
+import org.apache.wss4j.policy.SPConstants;
+import org.apache.wss4j.policy.model.AbstractSecurityAssertion;
+import org.apache.wss4j.policy.model.AlgorithmSuite;
 
 /**
  * This class retrieves a custom AlgorithmSuite for use with restricted security policies
@@ -35,14 +35,41 @@ public class RestrictedAlgorithmSuiteLoa
         bus.setExtension(this, AlgorithmSuiteLoader.class);
     }
 
-    public AlgorithmSuite getAlgorithmSuite(Element policyElement, SPConstants consts) {
-        if (policyElement != null) {
-            RestrictedAlgorithmSuite algorithmSuite = new RestrictedAlgorithmSuite(consts);
-            String algorithmSuiteName = DOMUtils.getFirstElement(policyElement).getLocalName();
-            algorithmSuite.setAlgorithmSuite(algorithmSuiteName);
-            return algorithmSuite;
-        }
-        return null;
+    public AlgorithmSuite getAlgorithmSuite(SPConstants.SPVersion version, Policy nestedPolicy)
{
+        return new CustomAlgorithmSuite(version, nestedPolicy); 
     }
 
+    private static class CustomAlgorithmSuite extends AlgorithmSuite {
+
+        CustomAlgorithmSuite(SPConstants.SPVersion version, Policy nestedPolicy) {
+            super(version, nestedPolicy);
+        }
+
+        @Override
+        protected AbstractSecurityAssertion cloneAssertion(Policy nestedPolicy) {
+            return new CustomAlgorithmSuite(getVersion(), nestedPolicy);
+        }
+
+        @Override
+        protected void parseCustomAssertion(Assertion assertion) {
+            String assertionName = assertion.getName().getLocalPart();
+            
+            AlgorithmSuiteType algorithmSuiteType = algorithmSuiteTypes.get(assertionName);
+            
+            setAlgorithmSuiteType(new AlgorithmSuiteType(
+                    assertionName,
+                    algorithmSuiteType.getDigest(),
+                    algorithmSuiteType.getEncryption(),
+                    algorithmSuiteType.getSymmetricKeyWrap(),
+                    algorithmSuiteType.getAsymmetricKeyWrap(),
+                    algorithmSuiteType.getEncryptionKeyDerivation(),
+                    algorithmSuiteType.getSignatureKeyDerivation(),
+                    algorithmSuiteType.getEncryptionDerivedKeyLength(),
+                    algorithmSuiteType.getSignatureDerivedKeyLength(),
+                    algorithmSuiteType.getMinimumSymmetricKeyLength(),
+                    algorithmSuiteType.getMaximumSymmetricKeyLength(),
+                    512,
+                    algorithmSuiteType.getMaximumAsymmetricKeyLength()));
+        }
+    }
 }

Modified: cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/logging.properties
URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/logging.properties?rev=1455187&r1=1455186&r2=1455187&view=diff
==============================================================================
--- cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/logging.properties
(original)
+++ cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/logging.properties
Mon Mar 11 15:35:06 2013
@@ -46,7 +46,7 @@ handlers= java.util.logging.ConsoleHandl
 # can be overriden by a facility specific level
 # Note that the ConsoleHandler also has a separate level
 # setting to limit messages printed to the console.
-.level= INFO
+.level= WARNING
 
 ############################################################
 # Handler specific properties.
@@ -60,7 +60,7 @@ java.util.logging.FileHandler.count = 1
 java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter
 
 # Limit the message that are printed on the console to INFO and above.
-java.util.logging.ConsoleHandler.level = INFO
+java.util.logging.ConsoleHandler.level = SEVERE
 java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
 
 



Mime
View raw message