ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1833033 - in /webservices/wss4j/trunk: ws-security-dom/src/main/java/org/apache/wss4j/dom/util/ ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/ ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/...
Date Wed, 06 Jun 2018 15:05:09 GMT
Author: coheigea
Date: Wed Jun  6 15:05:08 2018
New Revision: 1833033

URL: http://svn.apache.org/viewvc?rev=1833033&view=rev
Log:
Revert "Some fixes following from latest Santuario changes"

This reverts commit a09832bad7d50081d51e4653729a32d0827cfc32.

Modified:
    webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/EncryptionUtils.java
    webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SAMLTokenInputHandler.java
    webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SAMLTokenOutputProcessor.java

Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/EncryptionUtils.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/EncryptionUtils.java?rev=1833033&r1=1833032&r2=1833033&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/EncryptionUtils.java
(original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/EncryptionUtils.java
Wed Jun  6 15:05:08 2018
@@ -47,6 +47,7 @@ import javax.crypto.SecretKey;
 import javax.security.auth.callback.Callback;
 import javax.security.auth.callback.CallbackHandler;
 import javax.security.auth.callback.UnsupportedCallbackException;
+import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.ParserConfigurationException;
 
 import java.io.ByteArrayInputStream;
@@ -389,18 +390,19 @@ public final class EncryptionUtils {
 
         // For the xop:Include case, we need to replace the xop:Include Element with the
         // decrypted Element
+        DocumentBuilder db =
+                org.apache.xml.security.utils.XMLUtils.createDocumentBuilder(false);
         byte[] bytes = JavaUtils.getBytesFromStream(attachmentInputStream);
 
         Document document = null;
         try {
-            document = org.apache.xml.security.utils.XMLUtils.parse(new ByteArrayInputStream(bytes),
false);
+            document = db.parse(new ByteArrayInputStream(bytes));
         } catch (SAXException ex) {
             // See if a prefix was not bound. Try to fix the DOM Element in this case.
             if (ex.getMessage() != null && ex.getMessage().startsWith("The prefix")
                 && ex.getMessage().endsWith("is not bound.")) {
                 String fixedElementStr = setParentPrefixes(encData, new String(bytes));
-                document = org.apache.xml.security.utils.XMLUtils.parse(new ByteArrayInputStream(fixedElementStr.getBytes()),
-                                                                        false);
+                document = db.parse(new ByteArrayInputStream(fixedElementStr.getBytes()));
             } else {
                 throw ex;
             }
@@ -409,6 +411,7 @@ public final class EncryptionUtils {
         Node decryptedNode =
             encData.getOwnerDocument().importNode(document.getDocumentElement(), true);
         encData.getParentNode().appendChild(decryptedNode);
+        org.apache.xml.security.utils.XMLUtils.repoolDocumentBuilder(db);
         encData.getParentNode().removeChild(encData);
         return decryptedNode;
     }

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SAMLTokenInputHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SAMLTokenInputHandler.java?rev=1833033&r1=1833032&r2=1833033&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SAMLTokenInputHandler.java
(original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SAMLTokenInputHandler.java
Wed Jun  6 15:05:08 2018
@@ -32,6 +32,7 @@ import javax.xml.bind.JAXBElement;
 import javax.xml.bind.JAXBException;
 import javax.xml.bind.Unmarshaller;
 import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamException;
@@ -409,7 +410,9 @@ public class SAMLTokenInputHandler exten
             throws XMLSecurityException {
         Document document = null;
         try {
-            document = XMLUtils.newDocument(false);
+            DocumentBuilder db = XMLUtils.createDocumentBuilder(false);
+            document = db.newDocument();
+            XMLUtils.repoolDocumentBuilder(db);
         } catch (ParserConfigurationException e) {
             throw new WSSecurityException(WSSecurityException.ErrorCode.INVALID_SECURITY_TOKEN,
e);
         }

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SAMLTokenOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SAMLTokenOutputProcessor.java?rev=1833033&r1=1833032&r2=1833033&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SAMLTokenOutputProcessor.java
(original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SAMLTokenOutputProcessor.java
Wed Jun  6 15:05:08 2018
@@ -28,6 +28,7 @@ import java.util.List;
 
 import javax.crypto.spec.SecretKeySpec;
 import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.stream.XMLStreamException;
 
@@ -62,7 +63,6 @@ import org.apache.xml.security.stax.secu
 import org.apache.xml.security.stax.securityToken.SecurityTokenProvider;
 import org.apache.xml.security.utils.XMLUtils;
 import org.opensaml.saml.common.SAMLVersion;
-import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
 public class SAMLTokenOutputProcessor extends AbstractOutputProcessor {
@@ -442,8 +442,9 @@ public class SAMLTokenOutputProcessor ex
                 OutputProcessorUtils.updateSecurityHeaderOrder(outputProcessorChain, headerElementName,
getAction(), false);
 
                 try {
-                    Document doc = XMLUtils.newDocument(false);
-                    outputDOMElement(samlAssertionWrapper.toDOM(doc), subOutputProcessorChain);
+                    DocumentBuilder db = XMLUtils.createDocumentBuilder(false);
+                    outputDOMElement(samlAssertionWrapper.toDOM(db.newDocument()), subOutputProcessorChain);
+                    XMLUtils.repoolDocumentBuilder(db);
                 } catch (ParserConfigurationException ex) {
                     LOG.debug("Error writing out SAML Assertion", ex);
                     throw new XMLSecurityException(ex);



Mime
View raw message