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

Auth_Default: Use the new interface to Session::doLogin().

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2638 44740490-163a-0410-bde0-09ae8108e29a
parent 9b176286
No related branches found
No related tags found
No related merge requests found
...@@ -76,6 +76,12 @@ class SimpleSAML_Auth_Default { ...@@ -76,6 +76,12 @@ class SimpleSAML_Auth_Default {
/* Save persistent authentication data. */ /* Save persistent authentication data. */
$persistentAuthState = array(); $persistentAuthState = array();
if (isset($state['IdP'])) {
/* For backwards compatibility. */
$persistentAuthState['saml:sp:IdP'] = $state['IdP'];
}
if (isset($state['PersistentAuthData'])) { if (isset($state['PersistentAuthData'])) {
foreach ($state['PersistentAuthData'] as $key) { foreach ($state['PersistentAuthData'] as $key) {
if (isset($state[$key])) { if (isset($state[$key])) {
...@@ -84,6 +90,13 @@ class SimpleSAML_Auth_Default { ...@@ -84,6 +90,13 @@ class SimpleSAML_Auth_Default {
} }
} }
/* Add those that should always be included. */
foreach (array('Attributes', 'Expires', 'LogoutState', 'AuthnInstant') as $a) {
if (isset($state[$a])) {
$persistentAuthState[$a] = $state[$a];
}
}
return $persistentAuthState; return $persistentAuthState;
} }
...@@ -105,20 +118,6 @@ class SimpleSAML_Auth_Default { ...@@ -105,20 +118,6 @@ class SimpleSAML_Auth_Default {
/* Save session state. */ /* Save session state. */
$session = SimpleSAML_Session::getInstance(); $session = SimpleSAML_Session::getInstance();
$session->doLogin($state['SimpleSAML_Auth_Default.id'], self::extractPersistentAuthState($state)); $session->doLogin($state['SimpleSAML_Auth_Default.id'], self::extractPersistentAuthState($state));
$session->setAttributes($state['Attributes']);
if(array_key_exists('Expires', $state)) {
$session->setSessionDuration($state['Expires'] - time());
}
if (array_key_exists('LogoutState', $state)) {
$session->setLogoutState($state['LogoutState']);
}
if (array_key_exists('IdP', $state)) {
$session->setIdP($state['IdP']);
} else {
$session->setIdP(NULL);
}
if (is_string($return)) { if (is_string($return)) {
/* Redirect... */ /* Redirect... */
...@@ -252,26 +251,6 @@ class SimpleSAML_Auth_Default { ...@@ -252,26 +251,6 @@ class SimpleSAML_Auth_Default {
$session = SimpleSAML_Session::getInstance(); $session = SimpleSAML_Session::getInstance();
$session->doLogin($authId, self::extractPersistentAuthState($state)); $session->doLogin($authId, self::extractPersistentAuthState($state));
if (array_key_exists('Attributes', $state)) {
$session->setAttributes($state['Attributes']);
} else {
$session->setAttributes(array());
}
if(array_key_exists('Expires', $state)) {
$session->setSessionDuration($state['Expires'] - time());
}
if (array_key_exists('LogoutState', $state)) {
$session->setLogoutState($state['LogoutState']);
}
if (array_key_exists('IdP', $state)) {
$session->setIdP($state['IdP']);
} else {
$session->setIdP(NULL);
}
SimpleSAML_Utilities::redirect($redirectTo); SimpleSAML_Utilities::redirect($redirectTo);
} }
......
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