/** * Singleton accessor for the SimpleSAML_MetaShare_Store object. Will create a new instance * of the object if no instance exsists. If an instance already exists, this function will * return that. * * @return The SimpleSAML_MetaShare_Store object. */ public static function getInstance() { if (self::$instance === NULL) { self::$instance = new self(); } return self::$instance; }
*/ function showNotFound($entityId) { header('HTTP/1.0 404 Not Found'); header('Content-Type: text/plain'); echo "Could not find the given entity id.\n"; if ($entityId === NULL) { echo "No entity id given.\n"; } else { echo 'Entity id: ' . $entityId . "\n"; } exit; } if (!array_key_exists('entityid', $_GET)) { showNotFound(NULL); } $entityId = $_GET['entityid']; /* Load the metadata. */ $store = SimpleSAML_MetaShare_Store::getInstance(); $metadata = $store->getMetadata($entityId); if ($metadata === FALSE) { showNotFound($entityId); } /* Show the metadata. */ if (array_key_exists('mimetype', $_GET)) { $mimeType = $_GET['mimetype']; } else { $mimeType = 'application/samlmetadata+xml'; } header('Content-Type: ' . $mimeType); echo $metadata->ownerDocument->saveXML($metadata);