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 2019/06/26 10:28:01 UTC

svn commit: r1862120 - in /webservices/wss4j/branches/2_2_x-fixes: 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/...

Author: coheigea
Date: Wed Jun 26 10:28:01 2019
New Revision: 1862120

URL: http://svn.apache.org/viewvc?rev=1862120&view=rev
Log:
Picking up latest Santuario 2.1.x fixes

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

Modified: webservices/wss4j/branches/2_2_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/EncryptionUtils.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_2_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/EncryptionUtils.java?rev=1862120&r1=1862119&r2=1862120&view=diff
==============================================================================
--- webservices/wss4j/branches/2_2_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/EncryptionUtils.java (original)
+++ webservices/wss4j/branches/2_2_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/EncryptionUtils.java Wed Jun 26 10:28:01 2019
@@ -47,7 +47,6 @@ 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;
@@ -390,23 +389,21 @@ 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(true);
         byte[] bytes = JavaUtils.getBytesFromStream(attachmentInputStream);
 
         Document document = null;
         try {
-            document = db.parse(new ByteArrayInputStream(bytes));
+            document = org.apache.xml.security.utils.XMLUtils.read(new ByteArrayInputStream(bytes), false);
         } catch (SAXException ex) {
             // A prefix may not have been bound, try to fix the DOM Element in this case.
             String fixedElementStr = setParentPrefixes(encData, new String(bytes));
-            document = db.parse(new ByteArrayInputStream(fixedElementStr.getBytes()));
+            document = org.apache.xml.security.utils.XMLUtils.read(
+                new ByteArrayInputStream(fixedElementStr.getBytes()), false);
         }
 
         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/branches/2_2_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SAMLTokenInputHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_2_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SAMLTokenInputHandler.java?rev=1862120&r1=1862119&r2=1862120&view=diff
==============================================================================
--- webservices/wss4j/branches/2_2_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SAMLTokenInputHandler.java (original)
+++ webservices/wss4j/branches/2_2_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SAMLTokenInputHandler.java Wed Jun 26 10:28:01 2019
@@ -32,7 +32,6 @@ 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;
@@ -410,9 +409,7 @@ public class SAMLTokenInputHandler exten
             throws XMLSecurityException {
         Document document = null;
         try {
-            DocumentBuilder db = XMLUtils.createDocumentBuilder(false);
-            document = db.newDocument();
-            XMLUtils.repoolDocumentBuilder(db);
+            document = XMLUtils.newDocument();
         } catch (ParserConfigurationException e) {
             throw new WSSecurityException(WSSecurityException.ErrorCode.INVALID_SECURITY_TOKEN, e);
         }

Modified: webservices/wss4j/branches/2_2_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SAMLTokenOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_2_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SAMLTokenOutputProcessor.java?rev=1862120&r1=1862119&r2=1862120&view=diff
==============================================================================
--- webservices/wss4j/branches/2_2_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SAMLTokenOutputProcessor.java (original)
+++ webservices/wss4j/branches/2_2_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SAMLTokenOutputProcessor.java Wed Jun 26 10:28:01 2019
@@ -28,7 +28,6 @@ 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;
 
@@ -442,9 +441,7 @@ public class SAMLTokenOutputProcessor ex
                 OutputProcessorUtils.updateSecurityHeaderOrder(outputProcessorChain, headerElementName, getAction(), false);
 
                 try {
-                    DocumentBuilder db = XMLUtils.createDocumentBuilder(true);
-                    outputDOMElement(samlAssertionWrapper.toDOM(db.newDocument()), subOutputProcessorChain);
-                    XMLUtils.repoolDocumentBuilder(db);
+                    outputDOMElement(samlAssertionWrapper.toDOM(XMLUtils.newDocument()), subOutputProcessorChain);
                 } catch (ParserConfigurationException ex) {
                     LOG.debug("Error writing out SAML Assertion", ex);
                     throw new XMLSecurityException(ex);