Skip to content
Snippets Groups Projects
Commit 0597e7e9 authored by Olav Morken's avatar Olav Morken
Browse files

SAMLParser: Change processExtensions to use SimpleSAML_Utilities::getDOMChildren.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1975 44740490-163a-0410-bde0-09ae8108e29a
parent ab3e9d79
Branches
Tags
No related merge requests found
...@@ -927,43 +927,31 @@ class SimpleSAML_Metadata_SAMLParser { ...@@ -927,43 +927,31 @@ class SimpleSAML_Metadata_SAMLParser {
/** /**
* Parse and process a Extensions element. * Parse and process a Extensions element.
* *
* @param $element The DOMElement which represents the Organization element. * @param DOMElement $element The DOMElement which represents the Extensions element.
*/ */
private function processExtensions($element) { private function processExtensions(DOMElement $element) {
assert('$element instanceof DOMElement');
for($i = 0; $i < $element->childNodes->length; $i++) {
$child = $element->childNodes->item($i);
/* Skip text nodes. */ foreach (SimpleSAML_Utilities::getDOMChildren($element, 'Scope', '@shibmd') as $scope) {
if(!$child instanceof DOMElement) continue; $scope = SimpleSAML_Utilities::getDOMText($scope);
if (!empty($scope)) {
if(SimpleSAML_Utilities::isDOMElementOfType($child, 'Scope', '@shibmd')) { $this->scopes[] = $scope;
$text = SimpleSAML_Utilities::getDOMText($child);
if (!empty($text)) $this->scopes[] = $text;
} }
}
if(SimpleSAML_Utilities::isDOMElementOfType($child, 'Attribute', '@saml2')) {
if ($child->getAttribute('Name') === 'tags') {
for($j = 0; $j < $child->childNodes->length; $j++) {
$attributevalue = $child->childNodes->item($j);
if(SimpleSAML_Utilities::isDOMElementOfType($attributevalue, 'AttributeValue', '@saml2')) {
$tagname = SimpleSAML_Utilities::getDOMText($attributevalue); foreach (SimpleSAML_Utilities::getDOMChildren($element, 'Attribute', '@saml2') as $attribute) {
# echo 'attribute tags: ' . $tagname; exit; $name = $attribute->getAttribute('Name');
if (!empty($tagname)) $this->tags[] = $tagname; $values = array_map(
} array('SimpleSAML_Utilities', 'getDOMText'),
SimpleSAML_Utilities::getDOMChildren($attribute, 'AttributeValue', '@saml2')
);
if ($name === 'tags') {
foreach ($values as $tagname) {
if (!empty($tagname)) {
$this->tags[] = $tagname;
} }
} }
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment