|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace SimpleSAML\SAML2\XML\saml; |
|
6
|
|
|
|
|
7
|
|
|
use DOMElement; |
|
8
|
|
|
use SimpleSAML\SAML2\Assert\Assert; |
|
9
|
|
|
use SimpleSAML\SAML2\Type\SAMLAnyURIValue; |
|
10
|
|
|
use SimpleSAML\SAML2\XML\IdentifierTrait; |
|
11
|
|
|
use SimpleSAML\XML\SchemaValidatableElementInterface; |
|
12
|
|
|
use SimpleSAML\XML\SchemaValidatableElementTrait; |
|
13
|
|
|
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; |
|
14
|
|
|
use SimpleSAML\XMLSchema\Exception\TooManyElementsException; |
|
15
|
|
|
|
|
16
|
|
|
use function array_pop; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Class representing SAML 2 SubjectConfirmation element. |
|
20
|
|
|
* |
|
21
|
|
|
* @package simplesamlphp/saml2 |
|
22
|
|
|
*/ |
|
23
|
|
|
final class SubjectConfirmation extends AbstractSamlElement implements SchemaValidatableElementInterface |
|
|
|
|
|
|
24
|
|
|
{ |
|
25
|
|
|
use IdentifierTrait; |
|
26
|
|
|
use SchemaValidatableElementTrait; |
|
27
|
|
|
|
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* Initialize (and parse) a SubjectConfirmation element. |
|
31
|
|
|
* |
|
32
|
|
|
* @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $method |
|
33
|
|
|
* @param \SimpleSAML\SAML2\XML\saml\IdentifierInterface|null $identifier |
|
34
|
|
|
* @param \SimpleSAML\SAML2\XML\saml\SubjectConfirmationData|null $subjectConfirmationData |
|
35
|
|
|
*/ |
|
36
|
|
|
public function __construct( |
|
37
|
|
|
protected SAMLAnyURIValue $method, |
|
38
|
|
|
?IdentifierInterface $identifier = null, |
|
39
|
|
|
protected ?SubjectConfirmationData $subjectConfirmationData = null, |
|
40
|
|
|
) { |
|
41
|
|
|
$this->setIdentifier($identifier); |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* Collect the value of the Method-property |
|
47
|
|
|
* |
|
48
|
|
|
* @return \SimpleSAML\SAML2\Type\SAMLAnyURIValue |
|
49
|
|
|
*/ |
|
50
|
|
|
public function getMethod(): SAMLAnyURIValue |
|
51
|
|
|
{ |
|
52
|
|
|
return $this->method; |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* Collect the value of the SubjectConfirmationData-property |
|
58
|
|
|
* |
|
59
|
|
|
* @return \SimpleSAML\SAML2\XML\saml\SubjectConfirmationData|null |
|
60
|
|
|
*/ |
|
61
|
|
|
public function getSubjectConfirmationData(): ?SubjectConfirmationData |
|
62
|
|
|
{ |
|
63
|
|
|
return $this->subjectConfirmationData; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* Convert XML into a SubjectConfirmation |
|
69
|
|
|
* |
|
70
|
|
|
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException |
|
71
|
|
|
* if the qualified name of the supplied element is wrong |
|
72
|
|
|
* @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException |
|
73
|
|
|
* if the supplied element is missing one of the mandatory attributes |
|
74
|
|
|
* @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException |
|
75
|
|
|
* if too many child-elements of a type are specified |
|
76
|
|
|
*/ |
|
77
|
|
|
public static function fromXML(DOMElement $xml): static |
|
78
|
|
|
{ |
|
79
|
|
|
Assert::same($xml->localName, 'SubjectConfirmation', InvalidDOMElementException::class); |
|
80
|
|
|
Assert::same($xml->namespaceURI, SubjectConfirmation::NS, InvalidDOMElementException::class); |
|
81
|
|
|
|
|
82
|
|
|
$subjectConfirmationData = SubjectConfirmationData::getChildrenOfClass($xml); |
|
83
|
|
|
Assert::maxCount( |
|
84
|
|
|
$subjectConfirmationData, |
|
85
|
|
|
1, |
|
86
|
|
|
'More than one <saml:SubjectConfirmationData> in <saml:SubjectConfirmation>.', |
|
87
|
|
|
TooManyElementsException::class, |
|
88
|
|
|
); |
|
89
|
|
|
|
|
90
|
|
|
return new static( |
|
91
|
|
|
self::getAttribute($xml, 'Method', SAMLAnyURIValue::class), |
|
92
|
|
|
self::getIdentifierFromXML($xml), |
|
93
|
|
|
array_pop($subjectConfirmationData), |
|
94
|
|
|
); |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* Convert this element to XML. |
|
100
|
|
|
*/ |
|
101
|
|
|
public function toXML(?DOMElement $parent = null): DOMElement |
|
102
|
|
|
{ |
|
103
|
|
|
$e = $this->instantiateParentElement($parent); |
|
104
|
|
|
$e->setAttribute('Method', $this->getMethod()->getValue()); |
|
105
|
|
|
|
|
106
|
|
|
$this->getIdentifier()?->toXML($e); |
|
|
|
|
|
|
107
|
|
|
|
|
108
|
|
|
if ($this->getSubjectConfirmationData() !== null && !$this->getSubjectConfirmationData()->isEmptyElement()) { |
|
109
|
|
|
$this->getSubjectConfirmationData()->toXML($e); |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
return $e; |
|
113
|
|
|
} |
|
114
|
|
|
} |
|
115
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths