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: http://simplesamlphp.googlecode.com/svn/trunk@1817 44740490-163a-0410-bde0-09ae8108e29a
This commit is contained in:
parent
0ebea4bbee
commit
1582124731
|
@ -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' => 'saml2',
|
||||
'loginmethod' => 'authsource',
|
||||
|
||||
/*
|
||||
* The authentication source that should be used.
|
||||
*
|
||||
* This must be one of the authentication sources configured in config/authsources.php.
|
||||
*/
|
||||
'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(
|
||||
|
|
Reference in New Issue