Skip to content

Commit

Permalink
Finalize
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed Sep 13, 2024
1 parent 8a9b080 commit d1c5c19
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 20 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
25 changes: 8 additions & 17 deletions src/XML/cas/Attributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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),
);
}

Expand Down

0 comments on commit d1c5c19

Please sign in to comment.