From 63ab6ca331fc453ab67ad004f470dda757e9204a Mon Sep 17 00:00:00 2001 From: Olav Morken <olav.morken@uninett.no> Date: Wed, 26 May 2010 06:06:52 +0000 Subject: [PATCH] Session: Reintroduce get_sp_list(). git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2321 44740490-163a-0410-bde0-09ae8108e29a --- lib/SimpleSAML/Session.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/lib/SimpleSAML/Session.php b/lib/SimpleSAML/Session.php index a7744dd5f..4a18f9278 100644 --- a/lib/SimpleSAML/Session.php +++ b/lib/SimpleSAML/Session.php @@ -1021,6 +1021,37 @@ class SimpleSAML_Session { $this->dirty = TRUE; } + + /** + * Get a list of associated SAML 2 SPs. + * + * This function is just for backwards-compatibility. New code should + * use the SimpleSAML_IdP::getAssociations()-function. + * + * @return array Array of SAML 2 entitiyIDs. + * @deprecated Will be removed in the future. + */ + public function get_sp_list() { + + $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); + try { + $idpEntityId = $metadata->getMetaDataCurrentEntityID('saml20-idp-hosted'); + $idp = SimpleSAML_IdP::getById('saml2:' . $idpEntityId); + } catch (Exception $e) { + /* No SAML 2 IdP configured? */ + return arrray(); + } + + $ret = array(); + foreach ($idp->getAssociations() as $assoc) { + if (isset($assoc['saml:entityID'])) { + $ret[] = $assoc['saml:entityID']; + } + } + + return $ret; + } + } ?> \ No newline at end of file -- GitLab