cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject git commit: Some optimisations to the AbstractBindingBuilder
Date Mon, 28 Jul 2014 17:03:28 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 89bb59316 -> a48f67268


Some optimisations to the AbstractBindingBuilder


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

Branch: refs/heads/master
Commit: a48f67268bdb54f708badf7ca78c7e2be8824c7d
Parents: 89bb593
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Mon Jul 28 18:03:09 2014 +0100
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Mon Jul 28 18:03:09 2014 +0100

----------------------------------------------------------------------
 .../policyhandlers/AbstractBindingBuilder.java  | 27 ++++++++++----------
 1 file changed, 13 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/a48f6726/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 6aa6142..aeec3cb 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
@@ -164,11 +164,6 @@ public abstract class AbstractBindingBuilder extends AbstractCommonBindingHandle
     
     protected Set<WSEncryptionPart> encryptedTokensList = new HashSet<WSEncryptionPart>();
 
-    protected List<SupportingToken> endEncSuppTokList;
-    protected List<SupportingToken> endSuppTokList;
-    protected List<SupportingToken> sgndEndEncSuppTokList;
-    protected List<SupportingToken> sgndEndSuppTokList;
-    
     protected List<byte[]> signatures = new ArrayList<byte[]>();
 
     protected Element bottomUpElement;
@@ -178,7 +173,10 @@ public abstract class AbstractBindingBuilder extends AbstractCommonBindingHandle
     
     private Element lastSupportingTokenElement;
     private Element lastDerivedKeyElement;
+    
     private List<AbstractSecurityAssertion> suppTokenParts = new ArrayList<AbstractSecurityAssertion>();
+    private List<SupportingToken> endSuppTokList;
+    private List<SupportingToken> sgndEndSuppTokList;
     
     public AbstractBindingBuilder(
                            WSSConfig config,
@@ -1048,6 +1046,10 @@ public abstract class AbstractBindingBuilder extends AbstractCommonBindingHandle
             }            
         }
         
+        if (parts == null && elements == null && celements == null) {
+            return new ArrayList<WSEncryptionPart>();
+        }
+        
         List<WSEncryptionPart> signedParts = new ArrayList<WSEncryptionPart>();
         if (parts != null) {
             isBody = parts.isBody();
@@ -1118,6 +1120,10 @@ public abstract class AbstractBindingBuilder extends AbstractCommonBindingHandle
             }
         }
         
+        if (parts == null && elements == null) {
+            return new ArrayList<WSEncryptionPart>();
+        }
+        
         List<WSEncryptionPart> signedParts = new ArrayList<WSEncryptionPart>();
         if (parts != null) {
             isSignBody = parts.isBody();
@@ -2054,13 +2060,11 @@ public abstract class AbstractBindingBuilder extends AbstractCommonBindingHandle
         
         Collection<AssertionInfo> endorsingEncryptedSuppTokens =
             getAllAssertionsByLocalname(aim, SPConstants.ENDORSING_ENCRYPTED_SUPPORTING_TOKENS);
-        endEncSuppTokList 
-            = this.handleSupportingTokens(endorsingEncryptedSuppTokens, true);
+        endSuppTokList.addAll(this.handleSupportingTokens(endorsingEncryptedSuppTokens, true));
 
         Collection<AssertionInfo> sgndEndEncSuppTokens =
             getAllAssertionsByLocalname(aim, SPConstants.SIGNED_ENDORSING_ENCRYPTED_SUPPORTING_TOKENS);
-        sgndEndEncSuppTokList 
-            = this.handleSupportingTokens(sgndEndEncSuppTokens, true);
+        sgndEndSuppTokList.addAll(this.handleSupportingTokens(sgndEndEncSuppTokens, true));
 
         Collection<AssertionInfo> supportingToks =
             getAllAssertionsByLocalname(aim, SPConstants.SUPPORTING_TOKENS);
@@ -2074,7 +2078,6 @@ public abstract class AbstractBindingBuilder extends AbstractCommonBindingHandle
         addSignatureParts(sigSuppTokList, sigs);
         addSignatureParts(sgndEncSuppTokList, sigs);
         addSignatureParts(sgndEndSuppTokList, sigs);
-        addSignatureParts(sgndEndEncSuppTokList, sigs);
     }
     
     protected void doEndorse() {
@@ -2087,13 +2090,9 @@ public abstract class AbstractBindingBuilder extends AbstractCommonBindingHandle
             tokenProtect = ((SymmetricBinding)binding).isProtectTokens();
             sigProtect = ((SymmetricBinding)binding).isEncryptSignature();            
         }
-        // Adding the endorsing encrypted supporting tokens to endorsing supporting tokens
-        endSuppTokList.addAll(endEncSuppTokList);
         // Do endorsed signatures
         doEndorsedSignatures(endSuppTokList, tokenProtect, sigProtect);
 
-        //Adding the signed endorsed encrypted tokens to signed endorsed supporting tokens
-        sgndEndSuppTokList.addAll(sgndEndEncSuppTokList);
         // Do signed endorsing signatures
         doEndorsedSignatures(sgndEndSuppTokList, tokenProtect, sigProtect);
     } 


Mime
View raw message