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 2018/06/06 08:28:33 UTC
svn commit: r1832988 - in /webservices/wss4j/branches/2_1_x-fixes: parent/
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/wss...
Author: coheigea
Date: Wed Jun 6 08:28:32 2018
New Revision: 1832988
URL: http://svn.apache.org/viewvc?rev=1832988&view=rev
Log:
Some fixes following from latest Santuario changes
Modified:
webservices/wss4j/branches/2_1_x-fixes/parent/pom.xml
webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/EncryptionUtils.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SAMLTokenInputHandler.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SAMLTokenOutputProcessor.java
Modified: webservices/wss4j/branches/2_1_x-fixes/parent/pom.xml
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/parent/pom.xml?rev=1832988&r1=1832987&r2=1832988&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/parent/pom.xml (original)
+++ webservices/wss4j/branches/2_1_x-fixes/parent/pom.xml Wed Jun 6 08:28:32 2018
@@ -46,7 +46,7 @@
<woodstox.core.version>5.0.3</woodstox.core.version>
<wsdl4j.version>1.6.3</wsdl4j.version>
<xalan.version>2.7.2</xalan.version>
- <xmlsec.version>2.0.10</xmlsec.version>
+ <xmlsec.version>2.0.11-SNAPSHOT</xmlsec.version>
<xmlunit.version>1.6</xmlunit.version>
<!-- OSGi related properties -->
Modified: webservices/wss4j/branches/2_1_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_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/EncryptionUtils.java?rev=1832988&r1=1832987&r2=1832988&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/EncryptionUtils.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/EncryptionUtils.java Wed Jun 6 08:28:32 2018
@@ -49,7 +49,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;
@@ -392,19 +391,18 @@ 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 = db.parse(new ByteArrayInputStream(bytes));
+ document = org.apache.xml.security.utils.XMLUtils.parse(new ByteArrayInputStream(bytes), false);
} 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 = db.parse(new ByteArrayInputStream(fixedElementStr.getBytes()));
+ document = org.apache.xml.security.utils.XMLUtils.parse(new ByteArrayInputStream(fixedElementStr.getBytes()),
+ false);
} else {
throw ex;
}
@@ -413,7 +411,6 @@ 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/branches/2_1_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_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SAMLTokenInputHandler.java?rev=1832988&r1=1832987&r2=1832988&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SAMLTokenInputHandler.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SAMLTokenInputHandler.java Wed Jun 6 08:28:32 2018
@@ -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;
@@ -446,9 +445,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(false);
} catch (ParserConfigurationException e) {
throw new WSSecurityException(WSSecurityException.ErrorCode.INVALID_SECURITY_TOKEN, e);
}
Modified: webservices/wss4j/branches/2_1_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_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SAMLTokenOutputProcessor.java?rev=1832988&r1=1832987&r2=1832988&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SAMLTokenOutputProcessor.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SAMLTokenOutputProcessor.java Wed Jun 6 08:28:32 2018
@@ -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;
@@ -63,6 +62,7 @@ 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,9 +442,8 @@ public class SAMLTokenOutputProcessor ex
OutputProcessorUtils.updateSecurityHeaderOrder(outputProcessorChain, headerElementName, getAction(), false);
try {
- DocumentBuilder db = XMLUtils.createDocumentBuilder(false);
- outputDOMElement(samlAssertionWrapper.toDOM(db.newDocument()), subOutputProcessorChain);
- XMLUtils.repoolDocumentBuilder(db);
+ Document doc = XMLUtils.newDocument(false);
+ outputDOMElement(samlAssertionWrapper.toDOM(doc), subOutputProcessorChain);
} catch (ParserConfigurationException ex) {
LOG.debug("Error writing out SAML Assertion", ex);
throw new XMLSecurityException(ex);