|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace SimpleSAML\SAML11\XML\samlp; |
|
6
|
|
|
|
|
7
|
|
|
use DOMElement; |
|
8
|
|
|
use SimpleSAML\Assert\Assert; |
|
9
|
|
|
use SimpleSAML\SAML11\XML\saml\Action; |
|
10
|
|
|
use SimpleSAML\SAML11\XML\saml\Evidence; |
|
11
|
|
|
use SimpleSAML\SAML11\XML\saml\Subject; |
|
12
|
|
|
use SimpleSAML\XML\Exception\InvalidDOMElementException; |
|
13
|
|
|
use SimpleSAML\XML\Exception\MissingElementException; |
|
14
|
|
|
use SimpleSAML\XML\Exception\TooManyElementsException; |
|
15
|
|
|
|
|
16
|
|
|
use function array_pop; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Class representing a samlp:AuthorizationDecisionQuery element. |
|
20
|
|
|
* |
|
21
|
|
|
* @package simplesaml/saml11 |
|
22
|
|
|
*/ |
|
23
|
|
|
final class AuthorizationDecisionQuery extends AbstractAuthorizationDecisionQueryType |
|
24
|
|
|
{ |
|
25
|
|
|
/** |
|
26
|
|
|
* Convert XML into a AuthorizationDecisionQuery |
|
27
|
|
|
* |
|
28
|
|
|
* @param \DOMElement $xml The XML element we should load |
|
29
|
|
|
* @return static |
|
30
|
|
|
* |
|
31
|
|
|
* @throws \SimpleSAML\XML\Exception\InvalidDOMElementException |
|
32
|
|
|
* if the qualified name of the supplied element is wrong |
|
33
|
|
|
*/ |
|
34
|
|
|
public static function fromXML(DOMElement $xml): static |
|
35
|
|
|
{ |
|
36
|
|
|
Assert::same($xml->localName, 'AuthorizationDecisionQuery', InvalidDOMElementException::class); |
|
37
|
|
|
Assert::same($xml->namespaceURI, AuthorizationDecisionQuery::NS, InvalidDOMElementException::class); |
|
38
|
|
|
|
|
39
|
|
|
$resource = self::getAttribute($xml, 'Resource'); |
|
40
|
|
|
|
|
41
|
|
|
$subject = Subject::getChildrenOfClass($xml); |
|
42
|
|
|
Assert::minCount($subject, 1, MissingElementException::class); |
|
43
|
|
|
Assert::maxCount($subject, 1, TooManyElementsException::class); |
|
44
|
|
|
|
|
45
|
|
|
$action = Action::getChildrenOfClass($xml); |
|
46
|
|
|
Assert::minCount($action, 1, MissingElementException::class); |
|
47
|
|
|
|
|
48
|
|
|
$evidence = Evidence::getChildrenOfClass($xml); |
|
49
|
|
|
Assert::maxCount($evidence, 1, TooManyElementsException::class); |
|
50
|
|
|
|
|
51
|
|
|
return new static(array_pop($subject), $resource, array_pop($evidence), $action); |
|
52
|
|
|
} |
|
53
|
|
|
} |
|
54
|
|
|
|