ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1339539 - /webservices/wss4j/trunk/src/main/java/org/apache/ws/security/saml/ext/AssertionWrapper.java
Date Thu, 17 May 2012 10:22:24 GMT
Author: coheigea
Date: Thu May 17 10:22:23 2012
New Revision: 1339539

URL: http://svn.apache.org/viewvc?rev=1339539&view=rev
Log:
[WSS-390] - AssertionWrapper always tries to re-marshal when toDOM is called

Modified:
    webservices/wss4j/trunk/src/main/java/org/apache/ws/security/saml/ext/AssertionWrapper.java

Modified: webservices/wss4j/trunk/src/main/java/org/apache/ws/security/saml/ext/AssertionWrapper.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/main/java/org/apache/ws/security/saml/ext/AssertionWrapper.java?rev=1339539&r1=1339538&r2=1339539&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/main/java/org/apache/ws/security/saml/ext/AssertionWrapper.java
(original)
+++ webservices/wss4j/trunk/src/main/java/org/apache/ws/security/saml/ext/AssertionWrapper.java
Thu May 17 10:22:23 2012
@@ -141,6 +141,11 @@ public class AssertionWrapper {
     private final String defaultDSASignatureAlgorithm = SignatureConstants.ALGO_ID_SIGNATURE_DSA;
     
     /**
+     * Whether this object was instantiated with a DOM Element or an XMLObject initially
+     */
+    private final boolean fromDOM;
+    
+    /**
      * Constructor AssertionWrapper creates a new AssertionWrapper instance.
      *
      * @param element of type Element
@@ -150,6 +155,7 @@ public class AssertionWrapper {
         OpenSAMLUtil.initSamlEngine();
         
         parseElement(element);
+        fromDOM = true;
     }
 
     /**
@@ -194,6 +200,7 @@ public class AssertionWrapper {
                 + (xmlObject != null ? xmlObject.getClass().getName() : null)
             );
         }
+        fromDOM = false;
     }
 
     /**
@@ -229,9 +236,11 @@ public class AssertionWrapper {
         // See if we already have a DOM element in SAMLCallback
         if (samlCallbacks[0].getAssertionElement() != null) {
             parseElement(samlCallbacks[0].getAssertionElement());
+            fromDOM = true;
         } else {
             // If not then parse the SAMLCallback object
             parseCallback(samlCallbacks[0], parms);
+            fromDOM = false;
         }
     }
 
@@ -280,6 +289,13 @@ public class AssertionWrapper {
      * @return Element
      */
     public Element toDOM(Document doc) throws WSSecurityException {
+        if (fromDOM && assertionElement != null) {
+            parseElement(assertionElement);
+            if (doc != null) {
+                return (Element)doc.importNode(assertionElement, true);
+            }
+            return assertionElement;
+        }
         assertionElement = OpenSAMLUtil.toDom(xmlObject, doc);
         return assertionElement;
     }



Mime
View raw message