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

AuthMemCookie: Support for authentication sources.

Update issue 215
This change sort of fixes the use of initSSO.php for
www/authmemcookie.php by making it possible to use authsources with
AuthMemCookie.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1817 44740490-163a-0410-bde0-09ae8108e29a
parent f9b2480d
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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.
*
......
......@@ -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(
......
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