ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
PDPDescriptor.php
Go to the documentation of this file.
1<?php
2
3namespace SAML2\XML\md;
4
7
14{
22 public $AuthzService = array();
23
32
40 public $NameIDFormat = array();
41
48 public function __construct(\DOMElement $xml = null)
49 {
50 parent::__construct('md:PDPDescriptor', $xml);
51
52 if ($xml === null) {
53 return;
54 }
55
56 foreach (Utils::xpQuery($xml, './saml_metadata:AuthzService') as $ep) {
57 $this->AuthzService[] = new EndpointType($ep);
58 }
59 if (empty($this->AuthzService)) {
60 throw new \Exception('Must have at least one AuthzService in PDPDescriptor.');
61 }
62
63 foreach (Utils::xpQuery($xml, './saml_metadata:AssertionIDRequestService') as $ep) {
64 $this->AssertionIDRequestService[] = new EndpointType($ep);
65 }
66
67 $this->NameIDFormat = Utils::extractStrings($xml, Constants::NS_MD, 'NameIDFormat');
68 }
69
76 public function toXML(\DOMElement $parent)
77 {
78 assert(is_array($this->AuthzService));
79 assert(!empty($this->AuthzService));
80 assert(is_array($this->AssertionIDRequestService));
81 assert(is_array($this->NameIDFormat));
82
83 $e = parent::toXML($parent);
84
85 foreach ($this->AuthzService as $ep) {
86 $ep->toXML($e, 'md:AuthzService');
87 }
88
89 foreach ($this->AssertionIDRequestService as $ep) {
90 $ep->toXML($e, 'md:AssertionIDRequestService');
91 }
92
93 Utils::addStrings($e, Constants::NS_MD, 'md:NameIDFormat', false, $this->NameIDFormat);
94
95 return $e;
96 }
97}
An exception for terminatinating execution or to throw for unit testing.
const NS_MD
The namespace for the SAML 2 metadata.
Definition: Constants.php:230
static xpQuery(\DOMNode $node, $query)
Do an XPath query on an XML node.
Definition: Utils.php:191
static addStrings(\DOMElement $parent, $namespace, $name, $localized, array $values)
Append string elements.
Definition: Utils.php:659
static extractStrings(\DOMElement $parent, $namespaceURI, $localName)
Extract strings from a set of nodes.
Definition: Utils.php:610
toXML(\DOMElement $parent)
Add this PDPDescriptor to an EntityDescriptor.
__construct(\DOMElement $xml=null)
Initialize an IDPSSODescriptor.