/** * 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; }
/** * 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 unknwon. * @param array $validators An array of parent elements that may validate this element. */ private function __construct(SAML2_XML_md_EntityDescriptor $entityElement, $maxExpireTime, array $validators = array()) { 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); $this->scopes = $ext['scope']; $this->tags = $ext['tags']; /* 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); } } }
if (!array_key_exists('PATH_INFO', $_SERVER)) { throw new SimpleSAML_Error_BadRequest('Missing authentication source id in metadata URL'); } $config = SimpleSAML_Configuration::getInstance(); $sourceId = substr($_SERVER['PATH_INFO'], 1); $source = SimpleSAML_Auth_Source::getById($sourceId); if ($source === NULL) { throw new SimpleSAML_Error_NotFound('Could not find authentication source with id ' . $sourceId); } if (!$source instanceof sspmod_saml_Auth_Source_SP) { throw new SimpleSAML_Error_NotFound('Source isn\'t a SAML SP: ' . var_export($sourceId, TRUE)); } $entityId = $source->getEntityId(); $spconfig = $source->getMetadata(); $metaArray20 = array('AssertionConsumerService' => SimpleSAML_Module::getModuleURL('saml/sp/saml2-acs.php/' . $sourceId), 'SingleLogoutService' => SimpleSAML_Module::getModuleURL('saml/sp/saml2-logout.php/' . $sourceId)); $ed = new SAML2_XML_md_EntityDescriptor(); $ed->entityID = $entityId; $sp = new SAML2_XML_md_SPSSODescriptor(); $ed->RoleDescriptor[] = $sp; $sp->protocolSupportEnumeration = array('urn:oasis:names:tc:SAML:1.1:protocol', 'urn:oasis:names:tc:SAML:2.0:protocol'); $slo = new SAML2_XML_md_EndpointType(); $slo->Binding = SAML2_Const::BINDING_HTTP_REDIRECT; $slo->Location = SimpleSAML_Module::getModuleURL('saml/sp/saml2-logout.php/' . $sourceId); $sp->SingleLogoutService[] = $slo; $store = SimpleSAML_Store::getInstance(); if ($store instanceof SimpleSAML_Store_SQL) { /* We can properly support SOAP logout. */ $slo = new SAML2_XML_md_EndpointType(); $slo->Binding = SAML2_Const::BINDING_SOAP; $slo->Location = SimpleSAML_Module::getModuleURL('saml/sp/saml2-logout.php/' . $sourceId); $sp->SingleLogoutService[] = $slo;