diff --git a/lib/SimpleSAML/Session.php b/lib/SimpleSAML/Session.php index a7744dd5f6a83d05695b7d3dac99e050e0daef27..4a18f9278b737ff08c20faf3b7adcd88401f0450 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