ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
SPSSODescriptor.php
Go to the documentation of this file.
1 <?php
2 
3 namespace SAML2\XML\md;
4 
5 use SAML2\Utils;
6 
13 {
19  public $AuthnRequestsSigned = null;
20 
26  public $WantAssertionsSigned = null;
27 
35  public $AssertionConsumerService = array();
36 
44  public $AttributeConsumingService = array();
45 
51  public function __construct(\DOMElement $xml = null)
52  {
53  parent::__construct('md:SPSSODescriptor', $xml);
54 
55  if ($xml === null) {
56  return;
57  }
58 
59  $this->AuthnRequestsSigned = Utils::parseBoolean($xml, 'AuthnRequestsSigned', null);
60  $this->WantAssertionsSigned = Utils::parseBoolean($xml, 'WantAssertionsSigned', null);
61 
62  foreach (Utils::xpQuery($xml, './saml_metadata:AssertionConsumerService') as $ep) {
63  $this->AssertionConsumerService[] = new IndexedEndpointType($ep);
64  }
65 
66  foreach (Utils::xpQuery($xml, './saml_metadata:AttributeConsumingService') as $acs) {
68  }
69  }
70 
77  public function toXML(\DOMElement $parent)
78  {
79  assert(is_null($this->AuthnRequestsSigned) || is_bool($this->AuthnRequestsSigned));
80  assert(is_null($this->WantAssertionsSigned) || is_bool($this->WantAssertionsSigned));
81  assert(is_array($this->AssertionConsumerService));
82  assert(is_array($this->AttributeConsumingService));
83 
84  $e = parent::toXML($parent);
85 
86  if ($this->AuthnRequestsSigned === true) {
87  $e->setAttribute('AuthnRequestsSigned', 'true');
88  } elseif ($this->AuthnRequestsSigned === false) {
89  $e->setAttribute('AuthnRequestsSigned', 'false');
90  }
91 
92  if ($this->WantAssertionsSigned === true) {
93  $e->setAttribute('WantAssertionsSigned', 'true');
94  } elseif ($this->WantAssertionsSigned === false) {
95  $e->setAttribute('WantAssertionsSigned', 'false');
96  }
97 
98  foreach ($this->AssertionConsumerService as $ep) {
99  $ep->toXML($e, 'md:AssertionConsumerService');
100  }
101 
102  foreach ($this->AttributeConsumingService as $acs) {
103  $acs->toXML($e);
104  }
105  }
106 }
toXML(\DOMElement $parent)
Add this SPSSODescriptor to an EntityDescriptor.
__construct(\DOMElement $xml=null)
Initialize a SPSSODescriptor.
static parseBoolean(\DOMElement $node, $attributeName, $default=null)
Parse a boolean attribute.
Definition: Utils.php:276
static xpQuery(\DOMNode $node, $query)
Do an XPath query on an XML node.
Definition: Utils.php:191