Skip to content
Snippets Groups Projects
Commit bc38cac6 authored by Olav Morken's avatar Olav Morken
Browse files

SSOService: Provide backwardscompatibility with unset authority.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1957 44740490-163a-0410-bde0-09ae8108e29a
parent 89a5d954
No related branches found
No related tags found
No related merge requests found
...@@ -2164,6 +2164,40 @@ class SimpleSAML_Utilities { ...@@ -2164,6 +2164,40 @@ class SimpleSAML_Utilities {
return $firstAllowed; 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
...@@ -296,7 +296,7 @@ if(SimpleSAML_Auth_Source::getById($idpmetadata['auth']) !== NULL) { ...@@ -296,7 +296,7 @@ if(SimpleSAML_Auth_Source::getById($idpmetadata['auth']) !== NULL) {
$authority = $idpmetadata['auth']; $authority = $idpmetadata['auth'];
} else { } else {
$authSource = FALSE; $authSource = FALSE;
$authority = isset($idpmetadata['authority']) ? $idpmetadata['authority'] : NULL; $authority = SimpleSAML_Utilities::getAuthority($idpmetadata);
} }
......
...@@ -118,7 +118,7 @@ if(SimpleSAML_Auth_Source::getById($idpmetadata['auth']) !== NULL) { ...@@ -118,7 +118,7 @@ if(SimpleSAML_Auth_Source::getById($idpmetadata['auth']) !== NULL) {
$authority = $idpmetadata['auth']; $authority = $idpmetadata['auth'];
} else { } else {
$authSource = FALSE; $authSource = FALSE;
$authority = isset($idpmetadata['authority']) ? $idpmetadata['authority'] : NULL; $authority = SimpleSAML_Utilities::getAuthority($idpmetadata);
} }
/* /*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment