diff --git a/lib/SimpleSAML/Utilities.php b/lib/SimpleSAML/Utilities.php index 4de7246eea6cc594815d1c6f58e91a076158017a..ce173e73cc97bae4b8a92c540ced52db70ec9b9f 100644 --- a/lib/SimpleSAML/Utilities.php +++ b/lib/SimpleSAML/Utilities.php @@ -2164,6 +2164,40 @@ class SimpleSAML_Utilities { return $firstAllowed; } + + /** + * Retrieve the authority for the given IdP metadata. + * + * This function provides backwards-compatibility with + * previous versions of simpleSAMLphp. + * + * @param array $idpmetadata The IdP metadata. + * @return string The authority that should be used to validate the session. + */ + public static function getAuthority(array $idpmetadata) { + + if (isset($idpmetadata['authority'])) { + return $idpmetadata['authority']; + } + + $candidates = array( + 'auth/login-admin.php' => 'login-admin', + 'auth/login-auto.php' => 'login-auto', + 'auth/login-cas-ldap' => 'login-cas-ldap', + 'auth/login-feide.php' => 'login-feide', + 'auth/login-ldapmulti.php' => 'login-ldapmulti', + 'auth/login-radius.php' => 'login-radius', + 'auth/login-tlsclient.php' => 'tlsclient', + 'auth/login-wayf-ldap' => 'login-wayf-ldap', + 'auth/login.php' => 'login', + ); + if (isset($candidates[$idpmetadata['auth']])) { + return $candidates[$idpmetadata['auth']]; + } + throw new SimpleSAML_Error_Exception('You need to set \'authority\' in the metadata for ' . + var_export($idpmetadata['entityid'], TRUE) . '.'); + } + } ?> \ No newline at end of file diff --git a/www/saml2/idp/SSOService.php b/www/saml2/idp/SSOService.php index 9f6e6d3151b3a0f456580a6e8f381b920d65f3e7..cad872e75a25422a98ac9ecc1eb53bc7a2b6f111 100644 --- a/www/saml2/idp/SSOService.php +++ b/www/saml2/idp/SSOService.php @@ -296,7 +296,7 @@ if(SimpleSAML_Auth_Source::getById($idpmetadata['auth']) !== NULL) { $authority = $idpmetadata['auth']; } else { $authSource = FALSE; - $authority = isset($idpmetadata['authority']) ? $idpmetadata['authority'] : NULL; + $authority = SimpleSAML_Utilities::getAuthority($idpmetadata); } diff --git a/www/shib13/idp/SSOService.php b/www/shib13/idp/SSOService.php index 704b2278614b4c04d511f49986c84a74188a536e..c5683541398f8ad808ac7cb97edf2f2b70097bbf 100644 --- a/www/shib13/idp/SSOService.php +++ b/www/shib13/idp/SSOService.php @@ -118,7 +118,7 @@ if(SimpleSAML_Auth_Source::getById($idpmetadata['auth']) !== NULL) { $authority = $idpmetadata['auth']; } else { $authSource = FALSE; - $authority = isset($idpmetadata['authority']) ? $idpmetadata['authority'] : NULL; + $authority = SimpleSAML_Utilities::getAuthority($idpmetadata); } /*