ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1344652 - /webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/saml/OpenSAMLUtil.java
Date Thu, 31 May 2012 11:19:33 GMT
Author: coheigea
Date: Thu May 31 11:19:32 2012
New Revision: 1344652

URL: http://svn.apache.org/viewvc?rev=1344652&view=rev
Log:
Making it optional whether to sign an XMLObject when marshalling

Modified:
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/saml/OpenSAMLUtil.java

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/saml/OpenSAMLUtil.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/saml/OpenSAMLUtil.java?rev=1344652&r1=1344651&r2=1344652&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/saml/OpenSAMLUtil.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/saml/OpenSAMLUtil.java
Thu May 31 11:19:32 2012
@@ -103,14 +103,32 @@ public final class OpenSAMLUtil {
      * Convert a SAML Assertion from a XMLObject to a DOM Element
      *
      * @param xmlObject of type XMLObject
-     * @param doc       of type Document
+     * @param doc  of type Document
      * @return Element
      * @throws MarshallingException
      * @throws SignatureException
      */
     public static Element toDom(
-            XMLObject xmlObject,
-            Document doc
+        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;
@@ -126,12 +144,14 @@ public final class OpenSAMLUtil {
                     element = marshaller.marshall(xmlObject);
                 } else {
                     element = marshaller.marshall(xmlObject, doc);
-                }
+                } 
             } catch (MarshallingException ex) {
                 throw new WSSecurityException("Error marshalling a SAML assertion", ex);
             }
-
-            signXMLObject(xmlObject);
+    
+            if (signObject) {
+                signXMLObject(xmlObject);
+            }
         } finally {
             if (frag != null) {
                 while (doc.getFirstChild() != null) {



Mime
View raw message