summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/SimpleSAML/Bindings/Shib13/Artifact.php4
-rw-r--r--lib/SimpleSAML/Bindings/Shib13/HTTPPost.php2
-rw-r--r--lib/SimpleSAML/Metadata/SAMLParser.php2
-rw-r--r--lib/SimpleSAML/Utilities.php31
-rw-r--r--lib/SimpleSAML/Utils/XML.php37
5 files changed, 43 insertions, 33 deletions
diff --git a/lib/SimpleSAML/Bindings/Shib13/Artifact.php b/lib/SimpleSAML/Bindings/Shib13/Artifact.php
index 23f4352..0623bd1 100644
--- a/lib/SimpleSAML/Bindings/Shib13/Artifact.php
+++ b/lib/SimpleSAML/Bindings/Shib13/Artifact.php
@@ -84,14 +84,14 @@ class SimpleSAML_Bindings_Shib13_Artifact {
throw new SimpleSAML_Error_Exception('Expected artifact response to contain a <soap:Envelope> element.');
}
- $soapBody = SimpleSAML_Utilities::getDOMChildren($soapEnvelope, 'Body', 'http://schemas.xmlsoap.org/soap/envelope/');
+ $soapBody = SimpleSAML\Utils\XML::getDOMChildren($soapEnvelope, 'Body', 'http://schemas.xmlsoap.org/soap/envelope/');
if (count($soapBody) === 0) {
throw new SimpleSAML_Error_Exception('Couldn\'t find <soap:Body> in <soap:Envelope>.');
}
$soapBody = $soapBody[0];
- $responseElement = SimpleSAML_Utilities::getDOMChildren($soapBody, 'Response', 'urn:oasis:names:tc:SAML:1.0:protocol');
+ $responseElement = SimpleSAML\Utils\XML::getDOMChildren($soapBody, 'Response', 'urn:oasis:names:tc:SAML:1.0:protocol');
if (count($responseElement) === 0) {
throw new SimpleSAML_Error_Exception('Couldn\'t find <saml1p:Response> in <soap:Body>.');
}
diff --git a/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php b/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php
index 7cb87a8..b105225 100644
--- a/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php
+++ b/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php
@@ -67,7 +67,7 @@ class SimpleSAML_Bindings_Shib13_HTTPPost {
if ($signResponse) {
/* Sign the response - this must be done after encrypting the assertion. */
/* We insert the signature before the saml2p:Status element. */
- $statusElements = SimpleSAML_Utilities::getDOMChildren($responseroot, 'Status', '@saml1p');
+ $statusElements = SimpleSAML\Utils\XML::getDOMChildren($responseroot, 'Status', '@saml1p');
assert('count($statusElements) === 1');
$signer->sign($responseroot, $responseroot, $statusElements[0]);
diff --git a/lib/SimpleSAML/Metadata/SAMLParser.php b/lib/SimpleSAML/Metadata/SAMLParser.php
index 34e962f..3b9be11 100644
--- a/lib/SimpleSAML/Metadata/SAMLParser.php
+++ b/lib/SimpleSAML/Metadata/SAMLParser.php
@@ -1017,7 +1017,7 @@ class SimpleSAML_Metadata_SAMLParser {
$name = $attribute->getAttribute('Name');
$values = array_map(
array('SimpleSAML\Utils\XML', 'getDOMText'),
- SimpleSAML_Utilities::getDOMChildren($attribute, 'AttributeValue', '@saml2')
+ SimpleSAML\Utils\XML::getDOMChildren($attribute, 'AttributeValue', '@saml2')
);
if ($name === 'tags') {
diff --git a/lib/SimpleSAML/Utilities.php b/lib/SimpleSAML/Utilities.php
index 10d3cec..94c5fe5 100644
--- a/lib/SimpleSAML/Utilities.php
+++ b/lib/SimpleSAML/Utilities.php
@@ -661,37 +661,10 @@ class SimpleSAML_Utilities {
/**
- * This function finds direct descendants of a DOM element with the specified
- * localName and namespace. They are returned in an array.
- *
- * This function accepts the same shortcuts for namespaces as the isDOMElementOfType function.
- *
- * @param DOMElement $element The element we should look in.
- * @param string $localName The name the element should have.
- * @param string $namespaceURI The namespace the element should have.
- * @return array Array with the matching elements in the order they are found. An empty array is
- * returned if no elements match.
+ * @deprecated This function will be removed in SSP 2.0. Please use SimpleSAML\Utils\XML::getDOMChildren() instead.
*/
public static function getDOMChildren(DOMElement $element, $localName, $namespaceURI) {
- assert('is_string($localName)');
- assert('is_string($namespaceURI)');
-
- $ret = array();
-
- for($i = 0; $i < $element->childNodes->length; $i++) {
- $child = $element->childNodes->item($i);
-
- /* Skip text nodes and comment elements. */
- if($child instanceof DOMText || $child instanceof DOMComment) {
- continue;
- }
-
- if(self::isDOMElementOfType($child, $localName, $namespaceURI) === TRUE) {
- $ret[] = $child;
- }
- }
-
- return $ret;
+ return SimpleSAML\Utils\XML::getDOMChildren($element, $localName, $namespaceURI);
}
diff --git a/lib/SimpleSAML/Utils/XML.php b/lib/SimpleSAML/Utils/XML.php
index 5a2b3da..e18d7ff 100644
--- a/lib/SimpleSAML/Utils/XML.php
+++ b/lib/SimpleSAML/Utils/XML.php
@@ -131,6 +131,43 @@ class XML
/**
+ * This function finds direct descendants of a DOM element with the specified
+ * localName and namespace. They are returned in an array.
+ *
+ * This function accepts the same shortcuts for namespaces as the isDOMElementOfType function.
+ *
+ * @param \DOMElement $element The element we should look in.
+ * @param string $localName The name the element should have.
+ * @param string $namespaceURI The namespace the element should have.
+ *
+ * @return array Array with the matching elements in the order they are found. An empty array is
+ * returned if no elements match.
+ */
+ public static function getDOMChildren(\DOMElement $element, $localName, $namespaceURI)
+ {
+ assert('is_string($localName)');
+ assert('is_string($namespaceURI)');
+
+ $ret = array();
+
+ for ($i = 0; $i < $element->childNodes->length; $i++) {
+ $child = $element->childNodes->item($i);
+
+ // skip text nodes and comment elements
+ if ($child instanceof \DOMText || $child instanceof \DOMComment) {
+ continue;
+ }
+
+ if (self::isDOMElementOfType($child, $localName, $namespaceURI) === true) {
+ $ret[] = $child;
+ }
+ }
+
+ return $ret;
+ }
+
+
+ /**
* This function extracts the text from DOMElements which should contain only text content.
*
* @param \DOMElement $element The element we should extract text from.