ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
SAML2\XML\md\EntityDescriptor Class Reference
+ Inheritance diagram for SAML2\XML\md\EntityDescriptor:
+ Collaboration diagram for SAML2\XML\md\EntityDescriptor:

Public Member Functions

 __construct (\DOMElement $xml=null)
 Initialize an EntitiyDescriptor. 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...
 
 validate (XMLSecurityKey $key)
 Validate this element against a public key. More...
 
 setCertificates (array $certificates)
 Set the certificates that should be included in the element. More...
 
 getCertificates ()
 Retrieve the certificates that are included in the element (if any). More...
 
 getSignatureKey ()
 Retrieve the private key we should use to sign the element. More...
 
 setSignatureKey (XMLSecurityKey $signatureKey=null)
 Set the private key we should use to sign the element. More...
 

Data Fields

 $entityID
 
 $ID
 
 $validUntil
 
 $cacheDuration
 
 $Extensions = array()
 
 $RoleDescriptor = array()
 
 $AffiliationDescriptor = null
 
 $Organization = null
 
 $ContactPerson = array()
 
 $AdditionalMetadataLocation = 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 15 of file EntityDescriptor.php.

Constructor & Destructor Documentation

◆ __construct()

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

Initialize an EntitiyDescriptor.

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

Exception

Reimplemented from SAML2\SignedElementHelper.

Definition at line 97 of file EntityDescriptor.php.

98 {
99 parent::__construct($xml);
100
101 if ($xml === null) {
102 return;
103 }
104
105 if (!$xml->hasAttribute('entityID')) {
106 throw new \Exception('Missing required attribute entityID on EntityDescriptor.');
107 }
108 $this->entityID = $xml->getAttribute('entityID');
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 $this->Extensions = Extensions::getList($xml);
121
122 for ($node = $xml->firstChild; $node !== null; $node = $node->nextSibling) {
123 if (!($node instanceof \DOMElement)) {
124 continue;
125 }
126
127 if ($node->namespaceURI !== Constants::NS_MD) {
128 continue;
129 }
130
131 switch ($node->localName) {
132 case 'RoleDescriptor':
133 $this->RoleDescriptor[] = new UnknownRoleDescriptor($node);
134 break;
135 case 'IDPSSODescriptor':
136 $this->RoleDescriptor[] = new IDPSSODescriptor($node);
137 break;
138 case 'SPSSODescriptor':
139 $this->RoleDescriptor[] = new SPSSODescriptor($node);
140 break;
141 case 'AuthnAuthorityDescriptor':
142 $this->RoleDescriptor[] = new AuthnAuthorityDescriptor($node);
143 break;
144 case 'AttributeAuthorityDescriptor':
145 $this->RoleDescriptor[] = new AttributeAuthorityDescriptor($node);
146 break;
147 case 'PDPDescriptor':
148 $this->RoleDescriptor[] = new PDPDescriptor($node);
149 break;
150 }
151 }
152
153 $affiliationDescriptor = Utils::xpQuery($xml, './saml_metadata:AffiliationDescriptor');
154 if (count($affiliationDescriptor) > 1) {
155 throw new \Exception('More than one AffiliationDescriptor in the entity.');
156 } elseif (!empty($affiliationDescriptor)) {
157 $this->AffiliationDescriptor = new AffiliationDescriptor($affiliationDescriptor[0]);
158 }
159
160 if (empty($this->RoleDescriptor) && is_null($this->AffiliationDescriptor)) {
161 throw new \Exception('Must have either one of the RoleDescriptors or an AffiliationDescriptor in EntityDescriptor.');
162 } elseif (!empty($this->RoleDescriptor) && !is_null($this->AffiliationDescriptor)) {
163 throw new \Exception('AffiliationDescriptor cannot be combined with other RoleDescriptor elements in EntityDescriptor.');
164 }
165
166 $organization = Utils::xpQuery($xml, './saml_metadata:Organization');
167 if (count($organization) > 1) {
168 throw new \Exception('More than one Organization in the entity.');
169 } elseif (!empty($organization)) {
170 $this->Organization = new Organization($organization[0]);
171 }
172
173 foreach (Utils::xpQuery($xml, './saml_metadata:ContactPerson') as $cp) {
174 $this->ContactPerson[] = new ContactPerson($cp);
175 }
176
177 foreach (Utils::xpQuery($xml, './saml_metadata:AdditionalMetadataLocation') as $aml) {
178 $this->AdditionalMetadataLocation[] = new AdditionalMetadataLocation($aml);
179 }
180 }
const NS_MD
The namespace for the SAML 2 metadata.
Definition: Constants.php:230
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

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

+ Here is the call graph for this function:

Field Documentation

◆ $AdditionalMetadataLocation

SAML2\XML\md\EntityDescriptor::$AdditionalMetadataLocation = array()

Definition at line 89 of file EntityDescriptor.php.

◆ $AffiliationDescriptor

SAML2\XML\md\EntityDescriptor::$AffiliationDescriptor = null

Definition at line 68 of file EntityDescriptor.php.

◆ $cacheDuration

SAML2\XML\md\EntityDescriptor::$cacheDuration

Definition at line 43 of file EntityDescriptor.php.

◆ $ContactPerson

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

Definition at line 82 of file EntityDescriptor.php.

◆ $entityID

SAML2\XML\md\EntityDescriptor::$entityID

Definition at line 22 of file EntityDescriptor.php.

◆ $Extensions

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

Definition at line 52 of file EntityDescriptor.php.

◆ $ID

SAML2\XML\md\EntityDescriptor::$ID

Definition at line 29 of file EntityDescriptor.php.

◆ $Organization

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

Definition at line 75 of file EntityDescriptor.php.

◆ $RoleDescriptor

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

Definition at line 61 of file EntityDescriptor.php.

◆ $validUntil

SAML2\XML\md\EntityDescriptor::$validUntil

Definition at line 36 of file EntityDescriptor.php.


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