You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2011/05/19 13:33:19 UTC

svn commit: r1124690 - /cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java

Author: coheigea
Date: Thu May 19 11:33:19 2011
New Revision: 1124690

URL: http://svn.apache.org/viewvc?rev=1124690&view=rev
Log:
Minor clean up of the SymmetricBindingHandler

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

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java?rev=1124690&r1=1124689&r2=1124690&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java Thu May 19 11:33:19 2011
@@ -301,8 +301,7 @@ public class SymmetricBindingHandler ext
                 this.addEncryptedKeyElement(sigTokElem);
             } else if (isRequestor() && sigToken instanceof X509Token) {
                 Element el = sigTok.getToken();
-                sigTokElem = (Element)secHeader.getSecurityHeader().getOwnerDocument()
-                        .importNode(el, true);
+                sigTokElem = cloneElement(el);
                 this.addEncryptedKeyElement(sigTokElem);
             } else {
                 tokIncluded = false;
@@ -387,14 +386,13 @@ public class SymmetricBindingHandler ext
             }
 
             if (attached && encrTok.getAttachedReference() != null) {
-                dkEncr.setExternalKey(encrTok.getSecret(),
-                                      (Element)saaj.getSOAPPart()
-                                          .importNode((Element) encrTok.getAttachedReference(),
-                                true));
+                dkEncr.setExternalKey(
+                    encrTok.getSecret(), cloneElement(encrTok.getAttachedReference())
+                );
             } else if (encrTok.getUnattachedReference() != null) {
-                dkEncr.setExternalKey(encrTok.getSecret(), (Element)saaj.getSOAPPart()
-                        .importNode((Element) encrTok.getUnattachedReference(),
-                                true));
+                dkEncr.setExternalKey(
+                    encrTok.getSecret(), cloneElement(encrTok.getUnattachedReference())
+                );
             } else if (!isRequestor()) { 
                 // If the Encrypted key used to create the derived key is not
                 // attached use key identifier as defined in WSS1.1 section
@@ -569,8 +567,7 @@ public class SymmetricBindingHandler ext
         }
         
         if (ref != null) {
-            dkSign.setExternalKey(tok.getSecret(), 
-                                  (Element)saaj.getSOAPPart().importNode(ref, true));
+            dkSign.setExternalKey(tok.getSecret(), cloneElement(ref));
         } else if (!isRequestor() && policyToken.isDerivedKeys()) { 
             // If the Encrypted key used to create the derived key is not
             // attached use key identifier as defined in WSS1.1 section