diff --git a/composer.json b/composer.json index 890faf2..15481d4 100644 --- a/composer.json +++ b/composer.json @@ -13,11 +13,11 @@ "php": "^8.1", "ext-dom": "*", - "simplesamlphp/assert": "^1.1", - "simplesamlphp/xml-common": "^1.16" + "simplesamlphp/assert": "^1.3", + "simplesamlphp/xml-common": "^1.18" }, "require-dev": { - "simplesamlphp/simplesamlphp-test-framework": "^1.5" + "simplesamlphp/simplesamlphp-test-framework": "^1.7" }, "autoload": { "psr-4": { diff --git a/src/XML/cas/Attributes.php b/src/XML/cas/Attributes.php index 9bbd079..96c9c0d 100644 --- a/src/XML/cas/Attributes.php +++ b/src/XML/cas/Attributes.php @@ -30,6 +30,13 @@ final class Attributes extends AbstractCasElement /** The namespace-attribute for the xs:any element */ final public const XS_ANY_ELT_NAMESPACE = NS::ANY; + /** The exclusions for the xs:any element */ + final public const XS_ANY_ELT_EXCLUSIONS = [ + [C::NS_CAS, 'authenticationDate'], + [C::NS_CAS, 'longTermAuthenticationRequestTokenUsed'], + [C::NS_CAS, 'isFromNewLogin'], + ]; + /** * Initialize a cas:attributes element @@ -116,27 +123,11 @@ public static function fromXML(DOMElement $xml): static MissingElementException::class, ); - $elts = []; - foreach ($xml->childNodes as $elt) { - if (!($elt instanceof DOMElement)) { - continue; - } elseif ($elt->namespaceURI === C::NS_CAS) { - switch ($elt->localName) { - case 'authenticationDate': - case 'longTermAuthenticationRequestTokenUsed': - case 'isFromNewLogin': - continue 2; - } - } - - $elts[] = new Chunk($elt); - } - return new static( array_pop($authenticationDate), array_pop($longTermAuthenticationRequestTokenUsed), array_pop($isFromNewLogin), - $elts, + self::getChildElementsFromXML($xml), ); }