cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [3/4] cxf git commit: Fix for last commit
Date Fri, 03 Apr 2015 11:35:34 GMT
Fix for last commit


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/d5d87b8c
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/d5d87b8c
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/d5d87b8c

Branch: refs/heads/master
Commit: d5d87b8c7949bd0d8d8d5b5d5dc435e14aaf8fa4
Parents: 2f164ec
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Fri Apr 3 11:12:52 2015 +0100
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Fri Apr 3 12:33:57 2015 +0100

----------------------------------------------------------------------
 .../policyhandlers/AbstractBindingBuilder.java  |  2 +-
 .../AlgorithmSuitePolicyValidator.java          | 23 +++++++++-----------
 2 files changed, 11 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/d5d87b8c/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
index 306dafd..0ceb193 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
@@ -1637,7 +1637,7 @@ public abstract class AbstractBindingBuilder extends AbstractCommonBindingHandle
             .get(WSHandlerConstants.RECV_RESULTS));
         
         for (WSHandlerResult rResult : results) {
-            List<WSSecurityEngineResult> encryptedResults = rResult.getResults();
+            List<WSSecurityEngineResult> encryptedResults = rResult.getActionResults().get(WSConstants.ENCR);
             if (encryptedResults != null) {
                 for (WSSecurityEngineResult wser : encryptedResults) {
                     String encryptedKeyID = (String)wser.get(WSSecurityEngineResult.TAG_ID);

http://git-wip-us.apache.org/repos/asf/cxf/blob/d5d87b8c/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/AlgorithmSuitePolicyValidator.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/AlgorithmSuitePolicyValidator.java
b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/AlgorithmSuitePolicyValidator.java
index 3add3ed..5488764 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/AlgorithmSuitePolicyValidator.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/AlgorithmSuitePolicyValidator.java
@@ -69,8 +69,7 @@ public class AlgorithmSuitePolicyValidator extends AbstractSecurityPolicyValidat
             AlgorithmSuite algorithmSuite = (AlgorithmSuite)ai.getAssertion();
             ai.setAsserted(true);
             
-            boolean valid = validatePolicy(ai, algorithmSuite, parameters.getSignedResults(),
-                                           parameters.getEncryptedResults());
+            boolean valid = validatePolicy(ai, algorithmSuite, parameters.getResults().getResults());
             if (valid) {
                 String namespace = algorithmSuite.getAlgorithmSuiteType().getNamespace();
                 String name = algorithmSuite.getAlgorithmSuiteType().getName();
@@ -88,19 +87,17 @@ public class AlgorithmSuitePolicyValidator extends AbstractSecurityPolicyValidat
     }
     
     private boolean validatePolicy(
-        AssertionInfo ai, AlgorithmSuite algorithmPolicy, 
-        List<WSSecurityEngineResult> signedResults, List<WSSecurityEngineResult>
encryptedResults
+        AssertionInfo ai, AlgorithmSuite algorithmPolicy, List<WSSecurityEngineResult>
results
     ) {
-        for (WSSecurityEngineResult signedResult : signedResults) {
-            if (!checkSignatureAlgorithms(signedResult, algorithmPolicy, ai)) {
+        
+        for (WSSecurityEngineResult result : results) {
+            Integer action = (Integer)result.get(WSSecurityEngineResult.TAG_ACTION);
+            if (WSConstants.SIGN == action 
+                && !checkSignatureAlgorithms(result, algorithmPolicy, ai)) {
+                return false;
+            } else if (WSConstants.ENCR == action
+                && !checkEncryptionAlgorithms(result, algorithmPolicy, ai)) {
                 return false;
-            }
-        }
-        if (encryptedResults != null) {
-            for (WSSecurityEngineResult encryptedResult : encryptedResults) {
-                if (!checkEncryptionAlgorithms(encryptedResult, algorithmPolicy, ai)) {
-                    return false;
-                }
             }
         }
         


Mime
View raw message