Пример #1
0
 /**
  * Retrieve the EntityDescriptor element which is generated for this entity.
  *
  * @return DOMElement The EntityDescriptor element of this entity.
  */
 public function getEntityDescriptor()
 {
     $xml = $this->entityDescriptor->toXML();
     $xml->ownerDocument->appendChild($xml);
     return $xml;
 }
Пример #2
0
 /**
  * This is the constructor for the SAMLParser class.
  *
  * @param \SAML2\XML\md\EntityDescriptor $entityElement The EntityDescriptor.
  * @param int|NULL                      $maxExpireTime The unix timestamp for when this entity should expire, or
  *     NULL if unknown.
  * @param array                         $validators An array of parent elements that may validate this element.
  * @param array                         $parentExtensions An optional array of extensions from the parent element.
  */
 private function __construct(\SAML2\XML\md\EntityDescriptor $entityElement, $maxExpireTime, array $validators = array(), array $parentExtensions = null)
 {
     assert('is_null($maxExpireTime) || is_int($maxExpireTime)');
     $this->spDescriptors = array();
     $this->idpDescriptors = array();
     $e = $entityElement->toXML();
     $e = $e->ownerDocument->saveXML($e);
     $this->entityDescriptor = base64_encode($e);
     $this->entityId = $entityElement->entityID;
     $expireTime = self::getExpireTime($entityElement, $maxExpireTime);
     $this->validators = $validators;
     $this->validators[] = $entityElement;
     // process Extensions element, if it exists
     $ext = self::processExtensions($entityElement, $parentExtensions);
     $this->scopes = $ext['scope'];
     $this->tags = $ext['tags'];
     $this->entityAttributes = $ext['EntityAttributes'];
     $this->registrationInfo = $ext['RegistrationInfo'];
     // look over the RoleDescriptors
     foreach ($entityElement->RoleDescriptor as $child) {
         if ($child instanceof \SAML2\XML\md\SPSSODescriptor) {
             $this->processSPSSODescriptor($child, $expireTime);
         } elseif ($child instanceof \SAML2\XML\md\IDPSSODescriptor) {
             $this->processIDPSSODescriptor($child, $expireTime);
         } elseif ($child instanceof \SAML2\XML\md\AttributeAuthorityDescriptor) {
             $this->processAttributeAuthorityDescriptor($child, $expireTime);
         }
     }
     if ($entityElement->Organization) {
         $this->processOrganization($entityElement->Organization);
     }
     if (!empty($entityElement->ContactPerson)) {
         foreach ($entityElement->ContactPerson as $contact) {
             $this->processContactPerson($contact);
         }
     }
 }