diff --git a/config-templates/authmemcookie.php b/config-templates/authmemcookie.php index 967151248b9cc19140a60d654a808fefeffdd060..036e8c2e6767cf2d888369865366d8d2d8576440 100644 --- a/config-templates/authmemcookie.php +++ b/config-templates/authmemcookie.php @@ -7,10 +7,20 @@ $config = array( /* - * What type of login Auth MemCookie will use. Can be either 'saml2' or 'shib13'. - * The default value is 'saml2'. + * What type of login Auth MemCookie will use. + * Can be either 'authsource', 'saml2' or 'shib13'. + * + * For backwards compatibility, the default value if unset is 'saml2'. + * New installations should use 'authsource'. + */ + 'loginmethod' => 'authsource', + + /* + * The authentication source that should be used. + * + * This must be one of the authentication sources configured in config/authsources.php. */ - 'loginmethod' => 'saml2', + 'authsource' => 'default-sp', /* * This is the name of the cookie we should save the session id in. The value of this option must match the diff --git a/lib/SimpleSAML/AuthMemCookie.php b/lib/SimpleSAML/AuthMemCookie.php index 79824d1f3f7f1bb89bfcf4f093609a3cf741ccc7..61adacbcc1df60170f6daa0283fb3d961e7db6a6 100644 --- a/lib/SimpleSAML/AuthMemCookie.php +++ b/lib/SimpleSAML/AuthMemCookie.php @@ -52,6 +52,7 @@ class SimpleSAML_AuthMemCookie { public function getLoginMethod() { $loginMethod = $this->amcConfig->getString('loginmethod', 'saml2'); $supportedLogins = array( + 'authsource', 'saml2', 'shib13', ); @@ -63,6 +64,17 @@ class SimpleSAML_AuthMemCookie { } + /** + * Retrieve the authentication source that should be used to authenticate the user. + * + * @return string The login type which should be used for Auth MemCookie. + */ + public function getAuthSource() { + + return $this->amcConfig->getString('authsource'); + } + + /** * This function retrieves the name of the cookie from the configuration. * diff --git a/www/authmemcookie.php b/www/authmemcookie.php index fde955233865ef6236f76c60ce4fb0830a597c38..dac9a362c56d1c366949c321fca693965ce48123 100644 --- a/www/authmemcookie.php +++ b/www/authmemcookie.php @@ -28,6 +28,12 @@ try { /* Check if the user is authorized. We attempt to authenticate the user if not. */ $loginMethod = $amc->getLoginMethod(); switch($loginMethod) { + case 'authsource': + /* The default now. */ + $sourceId = $amc->getAuthSource(); + $s = new SimpleSAML_Auth_Simple($sourceId); + $s->requireAuth(); + break; case 'saml2': if (!$session->isValid('saml2') ) { SimpleSAML_Utilities::redirect(