Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes aa85f5f4e -> cd5ac08a5


[CXF-6464] - Minor refactor of applied patch. This closes #77

Conflicts:
        
rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java


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

Branch: refs/heads/3.0.x-fixes
Commit: 2c1c372578ecb436b2ec38909413644277df8e3d
Parents: aa85f5f
Author: Colm O hEigeartaigh <cohei...@apache.org>
Authored: Thu Jun 18 12:27:29 2015 +0100
Committer: Colm O hEigeartaigh <cohei...@apache.org>
Committed: Thu Jun 18 15:22:53 2015 +0100

----------------------------------------------------------------------
 .../policyhandlers/SymmetricBindingHandler.java | 43 ++++++++++++--------
 1 file changed, 27 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/2c1c3725/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java
----------------------------------------------------------------------
diff --git 
a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java
 
b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java
index 6bc2528..717480e 100644
--- 
a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java
+++ 
b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java
@@ -480,12 +480,19 @@ public class SymmetricBindingHandler extends 
AbstractBindingBuilder {
             Element encrDKTokenElem = null;
             encrDKTokenElem = dkEncr.getdktElement();
             addDerivedKeyElement(encrDKTokenElem);
+            
             Element refList = dkEncr.encryptForExternalRef(null, encrParts);
+<<<<<<< HEAD
             if (atEnd) {
                 this.insertBeforeBottomUp(refList);
             } else {
                 this.addDerivedKeyElement(refList);                        
             }
+=======
+            List<Element> attachments = 
dkEncr.getAttachmentEncryptedDataElements();
+            addAttachmentsForEncryption(atEnd, refList, attachments);
+
+>>>>>>> e9e4d0b... [CXF-6464] - Minor refactor of applied patch. This closes 
#77
             return dkEncr;
         } catch (Exception e) {
             LOG.log(Level.FINE, e.getMessage(), e);
@@ -589,21 +596,7 @@ public class SymmetricBindingHandler extends 
AbstractBindingBuilder {
                    
                     Element refList = encr.encryptForRef(null, encrParts);
                     List<Element> attachments = 
encr.getAttachmentEncryptedDataElements();
-                    if (atEnd) {
-                        this.insertBeforeBottomUp(refList);
-                        if (attachments != null) {
-                            for (Element attachment : attachments) {
-                                this.insertBeforeBottomUp(attachment);
-                            }
-                        }
-                    } else {
-                        this.addDerivedKeyElement(refList);
-                        if (attachments != null) {
-                            for (Element attachment : attachments) {
-                                this.addDerivedKeyElement(attachment);
-                            }
-                        }
-                    }
+                    addAttachmentsForEncryption(atEnd, refList, attachments);
                     
                     return encr;
                 } catch (WSSecurityException e) {
@@ -613,7 +606,25 @@ public class SymmetricBindingHandler extends 
AbstractBindingBuilder {
             }
         }
         return null;
-    }    
+    }
+    
+    private void addAttachmentsForEncryption(boolean atEnd, Element refList, 
List<Element> attachments) {
+        if (atEnd) {
+            this.insertBeforeBottomUp(refList);
+            if (attachments != null) {
+                for (Element attachment : attachments) {
+                    this.insertBeforeBottomUp(attachment);
+                }
+            }
+        } else {
+            this.addDerivedKeyElement(refList);
+            if (attachments != null) {
+                for (Element attachment : attachments) {
+                    this.addDerivedKeyElement(attachment);
+                }
+            }
+        }
+    }
     
     private byte[] doSignatureDK(List<WSEncryptionPart> sigs,
                                AbstractTokenWrapper 
policyAbstractTokenWrapper, 

Reply via email to