ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
IDPSSODescriptor.php
Go to the documentation of this file.
1 <?php
2 
3 namespace SAML2\XML\md;
4 
6 use SAML2\Utils;
8 
15 {
21  public $WantAuthnRequestsSigned = null;
22 
31 
40 
49 
58 
66  public $Attribute = array();
67 
73  public function __construct(\DOMElement $xml = null)
74  {
75  parent::__construct('md:IDPSSODescriptor', $xml);
76 
77  if ($xml === null) {
78  return;
79  }
80 
81  $this->WantAuthnRequestsSigned = Utils::parseBoolean($xml, 'WantAuthnRequestsSigned', null);
82 
83  foreach (Utils::xpQuery($xml, './saml_metadata:SingleSignOnService') as $ep) {
84  $this->SingleSignOnService[] = new EndpointType($ep);
85  }
86 
87  foreach (Utils::xpQuery($xml, './saml_metadata:NameIDMappingService') as $ep) {
88  $this->NameIDMappingService[] = new EndpointType($ep);
89  }
90 
91  foreach (Utils::xpQuery($xml, './saml_metadata:AssertionIDRequestService') as $ep) {
92  $this->AssertionIDRequestService[] = new EndpointType($ep);
93  }
94 
95  $this->AttributeProfile = Utils::extractStrings($xml, Constants::NS_MD, 'AttributeProfile');
96 
97  foreach (Utils::xpQuery($xml, './saml_assertion:Attribute') as $a) {
98  $this->Attribute[] = new Attribute($a);
99  }
100  }
101 
108  public function toXML(\DOMElement $parent)
109  {
110  assert(is_null($this->WantAuthnRequestsSigned) || is_bool($this->WantAuthnRequestsSigned));
111  assert(is_array($this->SingleSignOnService));
112  assert(is_array($this->NameIDMappingService));
113  assert(is_array($this->AssertionIDRequestService));
114  assert(is_array($this->AttributeProfile));
115  assert(is_array($this->Attribute));
116 
117  $e = parent::toXML($parent);
118 
119  if ($this->WantAuthnRequestsSigned === true) {
120  $e->setAttribute('WantAuthnRequestsSigned', 'true');
121  } elseif ($this->WantAuthnRequestsSigned === false) {
122  $e->setAttribute('WantAuthnRequestsSigned', 'false');
123  }
124 
125  foreach ($this->SingleSignOnService as $ep) {
126  $ep->toXML($e, 'md:SingleSignOnService');
127  }
128 
129  foreach ($this->NameIDMappingService as $ep) {
130  $ep->toXML($e, 'md:NameIDMappingService');
131  }
132 
133  foreach ($this->AssertionIDRequestService as $ep) {
134  $ep->toXML($e, 'md:AssertionIDRequestService');
135  }
136 
137  Utils::addStrings($e, Constants::NS_MD, 'md:AttributeProfile', false, $this->AttributeProfile);
138 
139  foreach ($this->Attribute as $a) {
140  $a->toXML($e);
141  }
142 
143  return $e;
144  }
145 }
toXML(\DOMElement $parent)
Add this IDPSSODescriptor to an EntityDescriptor.
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
__construct(\DOMElement $xml=null)
Initialize an IDPSSODescriptor.
static parseBoolean(\DOMElement $node, $attributeName, $default=null)
Parse a boolean attribute.
Definition: Utils.php:276
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.