ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
SAML2\XML\md\RoleDescriptor Class Reference
+ Inheritance diagram for SAML2\XML\md\RoleDescriptor:
+ Collaboration diagram for SAML2\XML\md\RoleDescriptor:

Data Fields

 $ID
 
 $validUntil
 
 $cacheDuration
 
 $protocolSupportEnumeration = array()
 
 $errorURL
 
 $Extensions = array()
 
 $KeyDescriptor = array()
 
 $Organization = null
 
 $ContactPerson = array()
 

Protected Member Functions

 __construct ($elementName, \DOMElement $xml=null)
 Initialize a RoleDescriptor. More...
 
 toXML (\DOMElement $parent)
 Add this RoleDescriptor to an EntityDescriptor. More...
 
- Protected Member Functions inherited from SAML2\SignedElementHelper
 __construct (\DOMElement $xml=null)
 Initialize the helper class. More...
 
 signElement (\DOMElement $root, \DOMElement $insertBefore=null)
 Sign the given XML element. More...
 

Private Attributes

 $elementName
 

Additional Inherited Members

- Public Member Functions inherited from SAML2\SignedElementHelper
 addValidator ($function, $data)
 Add a method for validating this element. More...
 
 validate (XMLSecurityKey $key)
 Validate this element against a public key. More...
 
 getSignatureKey ()
 Retrieve the private key we should use to sign the message. More...
 
 setSignatureKey (XMLSecurityKey $signatureKey=null)
 Set the private key we should use to sign the message. More...
 
 setCertificates (array $certificates)
 Set the certificates that should be included in the message. More...
 
 getCertificates ()
 Retrieve the certificates that are included in the message. More...
 
 getValidatingCertificates ()
 Retrieve certificates that sign this element. More...
 

Detailed Description

Definition at line 14 of file RoleDescriptor.php.

Constructor & Destructor Documentation

◆ __construct()

SAML2\XML\md\RoleDescriptor::__construct (   $elementName,
\DOMElement  $xml = null 
)
protected

Initialize a RoleDescriptor.

Parameters
string$elementNameThe name of this element.
\DOMElement | null$xmlThe XML element we should load.
Exceptions

Definition at line 99 of file RoleDescriptor.php.

References SAML2\XML\md\RoleDescriptor\$elementName, $xml, SAML2\XML\md\Extensions\getList(), SAML2\Utils\xpQuery(), and SAML2\Utils\xsDateTimeToTimestamp().

100  {
101  assert(is_string($elementName));
102 
103  parent::__construct($xml);
104  $this->elementName = $elementName;
105 
106  if ($xml === null) {
107  return;
108  }
109 
110  if ($xml->hasAttribute('ID')) {
111  $this->ID = $xml->getAttribute('ID');
112  }
113  if ($xml->hasAttribute('validUntil')) {
114  $this->validUntil = Utils::xsDateTimeToTimestamp($xml->getAttribute('validUntil'));
115  }
116  if ($xml->hasAttribute('cacheDuration')) {
117  $this->cacheDuration = $xml->getAttribute('cacheDuration');
118  }
119 
120  if (!$xml->hasAttribute('protocolSupportEnumeration')) {
121  throw new \Exception('Missing protocolSupportEnumeration attribute on ' . $xml->localName);
122  }
123  $this->protocolSupportEnumeration = preg_split('/[\s]+/', $xml->getAttribute('protocolSupportEnumeration'));
124 
125  if ($xml->hasAttribute('errorURL')) {
126  $this->errorURL = $xml->getAttribute('errorURL');
127  }
128 
129  $this->Extensions = Extensions::getList($xml);
130 
131  foreach (Utils::xpQuery($xml, './saml_metadata:KeyDescriptor') as $kd) {
132  $this->KeyDescriptor[] = new KeyDescriptor($kd);
133  }
134 
135  $organization = Utils::xpQuery($xml, './saml_metadata:Organization');
136  if (count($organization) > 1) {
137  throw new \Exception('More than one Organization in the entity.');
138  } elseif (!empty($organization)) {
139  $this->Organization = new Organization($organization[0]);
140  }
141 
142  foreach (Utils::xpQuery($xml, './saml_metadata:ContactPerson') as $cp) {
143  $this->contactPersons[] = new ContactPerson($cp);
144  }
145  }
$xml
Definition: metadata.php:240
static xpQuery(\DOMNode $node, $query)
Do an XPath query on an XML node.
Definition: Utils.php:191
static xsDateTimeToTimestamp($time)
This function converts a SAML2 timestamp on the form yyyy-mm-ddThh:mm:ss(.s+)?Z to a UNIX timestamp...
Definition: Utils.php:721
static getList(\DOMElement $parent)
Get a list of Extensions in the given element.
Definition: Extensions.php:27
+ Here is the call graph for this function:

Member Function Documentation

◆ toXML()

SAML2\XML\md\RoleDescriptor::toXML ( \DOMElement  $parent)
protected

Add this RoleDescriptor to an EntityDescriptor.

Parameters
\DOMElement$parentThe EntityDescriptor we should append this endpoint to.
Returns

Definition at line 153 of file RoleDescriptor.php.

References SAML2\XML\md\Extensions\addList(), and SAML2\Constants\NS_MD.

154  {
155  assert(is_null($this->ID) || is_string($this->ID));
156  assert(is_null($this->validUntil) || is_int($this->validUntil));
157  assert(is_null($this->cacheDuration) || is_string($this->cacheDuration));
158  assert(is_array($this->protocolSupportEnumeration));
159  assert(is_null($this->errorURL) || is_string($this->errorURL));
160  assert(is_array($this->Extensions));
161  assert(is_array($this->KeyDescriptor));
162  assert(is_null($this->Organization) || $this->Organization instanceof Organization);
163  assert(is_array($this->ContactPerson));
164 
165  $e = $parent->ownerDocument->createElementNS(Constants::NS_MD, $this->elementName);
166  $parent->appendChild($e);
167 
168  if (isset($this->ID)) {
169  $e->setAttribute('ID', $this->ID);
170  }
171 
172  if (isset($this->validUntil)) {
173  $e->setAttribute('validUntil', gmdate('Y-m-d\TH:i:s\Z', $this->validUntil));
174  }
175 
176  if (isset($this->cacheDuration)) {
177  $e->setAttribute('cacheDuration', $this->cacheDuration);
178  }
179 
180  $e->setAttribute('protocolSupportEnumeration', implode(' ', $this->protocolSupportEnumeration));
181 
182  if (isset($this->errorURL)) {
183  $e->setAttribute('errorURL', $this->errorURL);
184  }
185 
186  Extensions::addList($e, $this->Extensions);
187 
188  foreach ($this->KeyDescriptor as $kd) {
189  $kd->toXML($e);
190  }
191 
192  if (isset($this->Organization)) {
193  $this->Organization->toXML($e);
194  }
195 
196  foreach ($this->ContactPerson as $cp) {
197  $cp->toXML($e);
198  }
199 
200  return $e;
201  }
const NS_MD
The namespace for the SAML 2 metadata.
Definition: Constants.php:225
static addList(\DOMElement $parent, array $extensions)
Add a list of Extensions to the given element.
Definition: Extensions.php:70
+ Here is the call graph for this function:

Field Documentation

◆ $cacheDuration

SAML2\XML\md\RoleDescriptor::$cacheDuration

Definition at line 42 of file RoleDescriptor.php.

◆ $ContactPerson

SAML2\XML\md\RoleDescriptor::$ContactPerson = array()

Definition at line 90 of file RoleDescriptor.php.

◆ $elementName

SAML2\XML\md\RoleDescriptor::$elementName
private

◆ $errorURL

SAML2\XML\md\RoleDescriptor::$errorURL

Definition at line 56 of file RoleDescriptor.php.

◆ $Extensions

SAML2\XML\md\RoleDescriptor::$Extensions = array()

Definition at line 65 of file RoleDescriptor.php.

◆ $ID

SAML2\XML\md\RoleDescriptor::$ID

Definition at line 28 of file RoleDescriptor.php.

◆ $KeyDescriptor

SAML2\XML\md\RoleDescriptor::$KeyDescriptor = array()

Definition at line 74 of file RoleDescriptor.php.

◆ $Organization

SAML2\XML\md\RoleDescriptor::$Organization = null

Definition at line 81 of file RoleDescriptor.php.

◆ $protocolSupportEnumeration

SAML2\XML\md\RoleDescriptor::$protocolSupportEnumeration = array()

Definition at line 49 of file RoleDescriptor.php.

◆ $validUntil

SAML2\XML\md\RoleDescriptor::$validUntil

Definition at line 35 of file RoleDescriptor.php.


The documentation for this class was generated from the following file: