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

Auth MemCookie: Add support for shib13 authentication.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@692 44740490-163a-0410-bde0-09ae8108e29a
parent 3ac44778
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,12 @@
$config = array(
/*
* What type of login Auth MemCookie will use. Can be either 'saml2' or 'shib13'.
* The default value is 'saml2'.
*/
'loginmethod' => 'saml2',
/*
* This is the name of the cookie we should save the session id in. The value of this option must match the
* Auth_memCookie_CookieName option in the Auth MemCookie configuration. The default value is 'AuthMemCookie'.
......
......@@ -46,6 +46,25 @@ class SimpleSAML_AuthMemCookie {
}
/**
* Retrieve the login method which should be used to authenticate the user.
*
* @return The login type which should be used for Auth MemCookie.
*/
public function getLoginMethod() {
$loginMethod = $this->amcConfig->getValue('loginmethod', 'saml2');
$supportedLogins = array(
'saml2',
'shib13',
);
if(!in_array($loginMethod, $supportedLogins, TRUE)) {
throw new Exception('Configuration option \'loginmethod\' contains an invalid value.');
}
return $loginMethod;
}
/**
* This function retrieves the name of the cookie from the configuration.
*
......
......@@ -26,11 +26,27 @@ try {
$amc = SimpleSAML_AuthMemCookie::getInstance();
/* Check if the user is authorized. We attempt to authenticate the user if not. */
if (!$session->isValid('saml2') ) {
SimpleSAML_Utilities::redirect(
'/' . $globalConfig->getBaseURL() . 'saml2/sp/initSSO.php',
array('RelayState' => SimpleSAML_Utilities::selfURL())
);
$loginMethod = $amc->getLoginMethod();
switch($loginMethod) {
case 'saml2':
if (!$session->isValid('saml2') ) {
SimpleSAML_Utilities::redirect(
'/' . $globalConfig->getBaseURL() . 'saml2/sp/initSSO.php',
array('RelayState' => SimpleSAML_Utilities::selfURL())
);
}
break;
case 'shib13':
if (!$session->isValid('shib13') ) {
SimpleSAML_Utilities::redirect(
'/' . $globalConfig->getBaseURL() . 'shib13/sp/initSSO.php',
array('RelayState' => SimpleSAML_Utilities::selfURL())
);
}
break;
default:
/* Should never happen, as the login method is checked in the AuthMemCookie class. */
throw new Exception('Invalid login method.');
}
......
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