cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject cxf git commit: An efficiency improvement when reconciling encrypted and signed refs
Date Tue, 07 Jul 2015 15:18:47 GMT
Repository: cxf
Updated Branches:
  refs/heads/master f3cfadb6e -> 4ddc8d5b3


An efficiency improvement when reconciling encrypted and signed refs


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

Branch: refs/heads/master
Commit: 4ddc8d5b349e7ab78d5562ee002fc7baef33b5f1
Parents: f3cfadb
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Tue Jul 7 15:37:09 2015 +0100
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Tue Jul 7 15:37:23 2015 +0100

----------------------------------------------------------------------
 .../ws/security/wss4j/CryptoCoverageUtil.java   | 38 ++++++++++++--------
 1 file changed, 24 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/4ddc8d5b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/CryptoCoverageUtil.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/CryptoCoverageUtil.java
b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/CryptoCoverageUtil.java
index c2dba48..31e0319 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/CryptoCoverageUtil.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/CryptoCoverageUtil.java
@@ -69,21 +69,31 @@ public final class CryptoCoverageUtil {
         
         final List<WSDataRef> encryptedSignedRefs = new LinkedList<>();
         
-        for (WSDataRef encryptedRef : encryptedRefs) {
-            for (WSDataRef signedRef : signedRefs) {
-                if (signedRef.getProtectedElement() == encryptedRef.getEncryptedElement())
{
+        for (WSDataRef signedRef : signedRefs) {
+            Element protectedElement = signedRef.getProtectedElement();
+            if (protectedElement != null
+                && ("EncryptedData".equals(protectedElement.getLocalName())
+                && WSConstants.ENC_NS.equals(protectedElement.getNamespaceURI())
+                || WSConstants.ENCRYPTED_HEADER.equals(protectedElement.getLocalName())
+                && WSConstants.WSSE11_NS.equals(protectedElement.getNamespaceURI())
+                || WSConstants.ENCRYPED_ASSERTION_LN.equals(protectedElement.getLocalName())
+                && WSConstants.SAML2_NS.equals(protectedElement.getNamespaceURI())))
{
+                for (WSDataRef encryptedRef : encryptedRefs) {
+                    if (protectedElement == encryptedRef.getEncryptedElement()) {
 
-                    final WSDataRef encryptedSignedRef = new WSDataRef();
-                    encryptedSignedRef.setWsuId(signedRef.getWsuId());
-                    
-                    encryptedSignedRef.setContent(false);
-                    encryptedSignedRef.setName(encryptedRef.getName());
-                    encryptedSignedRef.setProtectedElement(encryptedRef
-                            .getProtectedElement());
-                    
-                    encryptedSignedRef.setXpath(encryptedRef.getXpath());
-                    
-                    encryptedSignedRefs.add(encryptedSignedRef);
+                        final WSDataRef encryptedSignedRef = new WSDataRef();
+                        encryptedSignedRef.setWsuId(signedRef.getWsuId());
+                        
+                        encryptedSignedRef.setContent(false);
+                        encryptedSignedRef.setName(encryptedRef.getName());
+                        encryptedSignedRef.setProtectedElement(encryptedRef
+                                .getProtectedElement());
+                        
+                        encryptedSignedRef.setXpath(encryptedRef.getXpath());
+                        
+                        encryptedSignedRefs.add(encryptedSignedRef);
+                        break;
+                    }
                 }
             }
         }


Mime
View raw message