ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
AttributeAuthorityDescriptor.php
Go to the documentation of this file.
1 <?php
2 
3 namespace SAML2\XML\md;
4 
6 use SAML2\Utils;
8 
15 {
24 
33 
41  public $NameIDFormat = array();
42 
51 
59  public $Attribute = array();
60 
67  public function __construct(\DOMElement $xml = null)
68  {
69  parent::__construct('md:AttributeAuthorityDescriptor', $xml);
70 
71  if ($xml === null) {
72  return;
73  }
74 
75  foreach (Utils::xpQuery($xml, './saml_metadata:AttributeService') as $ep) {
76  $this->AttributeService[] = new EndpointType($ep);
77  }
78  if (empty($this->AttributeService)) {
79  throw new \Exception('Must have at least one AttributeService in AttributeAuthorityDescriptor.');
80  }
81 
82  foreach (Utils::xpQuery($xml, './saml_metadata:AssertionIDRequestService') as $ep) {
83  $this->AssertionIDRequestService[] = new EndpointType($ep);
84  }
85 
86  $this->NameIDFormat = Utils::extractStrings($xml, Constants::NS_MD, 'NameIDFormat');
87 
88  $this->AttributeProfile = Utils::extractStrings($xml, Constants::NS_MD, 'AttributeProfile');
89 
90  foreach (Utils::xpQuery($xml, './saml_assertion:Attribute') as $a) {
91  $this->Attribute[] = new Attribute($a);
92  }
93  }
94 
101  public function toXML(\DOMElement $parent)
102  {
103  assert(is_array($this->AttributeService));
104  assert(!empty($this->AttributeService));
105  assert(is_array($this->AssertionIDRequestService));
106  assert(is_array($this->NameIDFormat));
107  assert(is_array($this->AttributeProfile));
108  assert(is_array($this->Attribute));
109 
110  $e = parent::toXML($parent);
111 
112  foreach ($this->AttributeService as $ep) {
113  $ep->toXML($e, 'md:AttributeService');
114  }
115 
116  foreach ($this->AssertionIDRequestService as $ep) {
117  $ep->toXML($e, 'md:AssertionIDRequestService');
118  }
119 
120  Utils::addStrings($e, Constants::NS_MD, 'md:NameIDFormat', false, $this->NameIDFormat);
121 
122  Utils::addStrings($e, Constants::NS_MD, 'md:AttributeProfile', false, $this->AttributeProfile);
123 
124  foreach ($this->Attribute as $a) {
125  $a->toXML($e);
126  }
127 
128  return $e;
129  }
130 }
__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
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.
toXML(\DOMElement $parent)
Add this AttributeAuthorityDescriptor to an EntityDescriptor.