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

Public Member Functions

 __construct (\DOMElement $xml=null)
 Initialize a AffiliationDescriptor. More...
 
 toXML (\DOMElement $parent)
 Add this AffiliationDescriptor to an EntityDescriptor. More...
 
- 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...
 

Data Fields

 $affiliationOwnerID
 
 $ID
 
 $validUntil
 
 $cacheDuration
 
 $Extensions = array()
 
 $AffiliateMember = array()
 
 $KeyDescriptor = array()
 

Additional Inherited Members

- 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...
 

Detailed Description

Definition at line 14 of file AffiliationDescriptor.php.

Constructor & Destructor Documentation

◆ __construct()

SAML2\XML\md\AffiliationDescriptor::__construct ( \DOMElement  $xml = null)

Initialize a AffiliationDescriptor.

Parameters
\DOMElement | null$xmlThe XML element we should load.
Exceptions

Definition at line 77 of file AffiliationDescriptor.php.

References $xml, SAML2\Utils\extractStrings(), SAML2\XML\md\Extensions\getList(), SAML2\Constants\NS_MD, SAML2\Utils\xpQuery(), and SAML2\Utils\xsDateTimeToTimestamp().

78  {
79  parent::__construct($xml);
80 
81  if ($xml === null) {
82  return;
83  }
84 
85  if (!$xml->hasAttribute('affiliationOwnerID')) {
86  throw new \Exception('Missing affiliationOwnerID on AffiliationDescriptor.');
87  }
88  $this->affiliationOwnerID = $xml->getAttribute('affiliationOwnerID');
89 
90  if ($xml->hasAttribute('ID')) {
91  $this->ID = $xml->getAttribute('ID');
92  }
93 
94  if ($xml->hasAttribute('validUntil')) {
95  $this->validUntil = Utils::xsDateTimeToTimestamp($xml->getAttribute('validUntil'));
96  }
97 
98  if ($xml->hasAttribute('cacheDuration')) {
99  $this->cacheDuration = $xml->getAttribute('cacheDuration');
100  }
101 
102  $this->Extensions = Extensions::getList($xml);
103 
104  $this->AffiliateMember = Utils::extractStrings($xml, Constants::NS_MD, 'AffiliateMember');
105  if (empty($this->AffiliateMember)) {
106  throw new \Exception('Missing AffiliateMember in AffiliationDescriptor.');
107  }
108 
109  foreach (Utils::xpQuery($xml, './saml_metadata:KeyDescriptor') as $kd) {
110  $this->KeyDescriptor[] = new KeyDescriptor($kd);
111  }
112  }
static extractStrings(\DOMElement $parent, $namespaceURI, $localName)
Extract strings from a set of nodes.
Definition: Utils.php:610
$xml
Definition: metadata.php:240
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
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\AffiliationDescriptor::toXML ( \DOMElement  $parent)

Add this AffiliationDescriptor to an EntityDescriptor.

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

Definition at line 120 of file AffiliationDescriptor.php.

References SAML2\XML\md\Extensions\addList(), SAML2\Utils\addStrings(), SAML2\Constants\NS_MD, and SAML2\SignedElementHelper\signElement().

121  {
122  assert(is_string($this->affiliationOwnerID));
123  assert(is_null($this->ID) || is_string($this->ID));
124  assert(is_null($this->validUntil) || is_int($this->validUntil));
125  assert(is_null($this->cacheDuration) || is_string($this->cacheDuration));
126  assert(is_array($this->Extensions));
127  assert(is_array($this->AffiliateMember));
128  assert(!empty($this->AffiliateMember));
129  assert(is_array($this->KeyDescriptor));
130 
131  $e = $parent->ownerDocument->createElementNS(Constants::NS_MD, 'md:AffiliationDescriptor');
132  $parent->appendChild($e);
133 
134  $e->setAttribute('affiliationOwnerID', $this->affiliationOwnerID);
135 
136  if (isset($this->ID)) {
137  $e->setAttribute('ID', $this->ID);
138  }
139 
140  if (isset($this->validUntil)) {
141  $e->setAttribute('validUntil', gmdate('Y-m-d\TH:i:s\Z', $this->validUntil));
142  }
143 
144  if (isset($this->cacheDuration)) {
145  $e->setAttribute('cacheDuration', $this->cacheDuration);
146  }
147 
148  Extensions::addList($e, $this->Extensions);
149 
150  Utils::addStrings($e, Constants::NS_MD, 'md:AffiliateMember', false, $this->AffiliateMember);
151 
152  foreach ($this->KeyDescriptor as $kd) {
153  $kd->toXML($e);
154  }
155 
156  $this->signElement($e, $e->firstChild);
157 
158  return $e;
159  }
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
signElement(\DOMElement $root, \DOMElement $insertBefore=null)
Sign the given XML element.
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

◆ $AffiliateMember

SAML2\XML\md\AffiliationDescriptor::$AffiliateMember = array()

Definition at line 60 of file AffiliationDescriptor.php.

◆ $affiliationOwnerID

SAML2\XML\md\AffiliationDescriptor::$affiliationOwnerID

Definition at line 21 of file AffiliationDescriptor.php.

◆ $cacheDuration

SAML2\XML\md\AffiliationDescriptor::$cacheDuration

Definition at line 42 of file AffiliationDescriptor.php.

◆ $Extensions

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

Definition at line 51 of file AffiliationDescriptor.php.

◆ $ID

SAML2\XML\md\AffiliationDescriptor::$ID

Definition at line 28 of file AffiliationDescriptor.php.

◆ $KeyDescriptor

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

Definition at line 69 of file AffiliationDescriptor.php.

◆ $validUntil

SAML2\XML\md\AffiliationDescriptor::$validUntil

Definition at line 35 of file AffiliationDescriptor.php.


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