You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by co...@apache.org on 2012/05/31 13:14:52 UTC

svn commit: r1344650 - /webservices/wss4j/trunk/src/main/java/org/apache/ws/security/saml/ext/OpenSAMLUtil.java

Author: coheigea
Date: Thu May 31 11:14:52 2012
New Revision: 1344650

URL: http://svn.apache.org/viewvc?rev=1344650&view=rev
Log:
Make it optional whether to sign an XMLObject during marshalling

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

Modified: webservices/wss4j/trunk/src/main/java/org/apache/ws/security/saml/ext/OpenSAMLUtil.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/main/java/org/apache/ws/security/saml/ext/OpenSAMLUtil.java?rev=1344650&r1=1344649&r2=1344650&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/main/java/org/apache/ws/security/saml/ext/OpenSAMLUtil.java (original)
+++ webservices/wss4j/trunk/src/main/java/org/apache/ws/security/saml/ext/OpenSAMLUtil.java Thu May 31 11:14:52 2012
@@ -112,6 +112,24 @@ public final class OpenSAMLUtil {
         XMLObject xmlObject, 
         Document doc
     ) throws WSSecurityException {
+        return toDom(xmlObject, doc, true);
+    }
+    
+    /**
+     * Convert a SAML Assertion from a XMLObject to a DOM Element
+     *
+     * @param xmlObject of type XMLObject
+     * @param doc  of type Document
+     * @param signObject whether to sign the XMLObject during marshalling
+     * @return Element
+     * @throws MarshallingException
+     * @throws SignatureException
+     */
+    public static Element toDom(
+        XMLObject xmlObject, 
+        Document doc,
+        boolean signObject
+    ) throws WSSecurityException {
         Marshaller marshaller = marshallerFactory.getMarshaller(xmlObject);
         Element element = null;
         DocumentFragment frag = doc == null ? null : doc.createDocumentFragment();
@@ -131,7 +149,9 @@ public final class OpenSAMLUtil {
                 throw new WSSecurityException("Error marshalling a SAML assertion", ex);
             }
     
-            signXMLObject(xmlObject);
+            if (signObject) {
+                signXMLObject(xmlObject);
+            }
         } finally {
             if (frag != null) {
                 while (doc.getFirstChild() != null) {