ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
PDPDescriptor.php
Go to the documentation of this file.
1 <?php
2 
3 namespace SAML2\XML\md;
4 
6 use SAML2\Utils;
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 }
__construct(\DOMElement $xml=null)
Initialize an IDPSSODescriptor.
static extractStrings(\DOMElement $parent, $namespaceURI, $localName)
Extract strings from a set of nodes.
Definition: Utils.php:610
$xml
Definition: metadata.php:240
toXML(\DOMElement $parent)
Add this PDPDescriptor to an EntityDescriptor.
static addStrings(\DOMElement $parent, $namespace, $name, $localized, array $values)
Append string elements.
Definition: Utils.php:659
const NS_MD
The namespace for the SAML 2 metadata.
Definition: Constants.php:225
static xpQuery(\DOMNode $node, $query)
Do an XPath query on an XML node.
Definition: Utils.php:191
Create styles array
The data for the language used.