|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace SimpleSAML\SAML2\XML\saml; |
|
6
|
|
|
|
|
7
|
|
|
use DOMElement; |
|
8
|
|
|
use SimpleSAML\Assert\Assert; |
|
9
|
|
|
use SimpleSAML\XML\Exception\InvalidDOMElementException; |
|
10
|
|
|
use SimpleSAML\XML\Exception\SchemaViolationException; |
|
11
|
|
|
use SimpleSAML\XML\XMLStringElementTrait; |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* Class representing a saml:AuthenticatingAuthority element. |
|
15
|
|
|
* |
|
16
|
|
|
* @package simplesaml/saml2 |
|
17
|
|
|
*/ |
|
18
|
|
|
final class AuthenticatingAuthority extends AbstractSamlElement |
|
19
|
|
|
{ |
|
20
|
|
|
use XMLStringElementTrait; |
|
|
|
|
|
|
21
|
|
|
|
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* @param string $content |
|
25
|
|
|
*/ |
|
26
|
|
|
public function __construct(string $content) |
|
27
|
|
|
{ |
|
28
|
|
|
$this->setContent($content); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Validate the content of the element. |
|
34
|
|
|
* |
|
35
|
|
|
* @param string $content The value to go in the XML textContent |
|
36
|
|
|
* @throws \Exception on failure |
|
37
|
|
|
* @return void |
|
38
|
|
|
*/ |
|
39
|
|
|
protected function validateContent(string $content): void |
|
40
|
|
|
{ |
|
41
|
|
|
Assert::validURI($content, SchemaViolationException::class); // Covers the empty string |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* Convert XML into an AuthenticatingAuthority |
|
47
|
|
|
* |
|
48
|
|
|
* @param \DOMElement $xml The XML element we should load |
|
49
|
|
|
* @return self |
|
50
|
|
|
* |
|
51
|
|
|
* @throws \SimpleSAML\XML\Exception\InvalidDOMElementException |
|
52
|
|
|
* If the qualified name of the supplied element is wrong |
|
53
|
|
|
*/ |
|
54
|
|
|
public static function fromXML(DOMElement $xml): object |
|
55
|
|
|
{ |
|
56
|
|
|
Assert::same($xml->localName, 'AuthenticatingAuthority', InvalidDOMElementException::class); |
|
57
|
|
|
Assert::same($xml->namespaceURI, AuthenticatingAuthority::NS, InvalidDOMElementException::class); |
|
58
|
|
|
|
|
59
|
|
|
return new self($xml->textContent); |
|
60
|
|
|
} |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
|