diff --git a/lib/SimpleSAML/Auth/Default.php b/lib/SimpleSAML/Auth/Default.php index 8b735d37be31cebe8c9e2f70a1fe70523f35998d..395809f558648ce56cc833dea9711770df447ad9 100644 --- a/lib/SimpleSAML/Auth/Default.php +++ b/lib/SimpleSAML/Auth/Default.php @@ -76,6 +76,12 @@ class SimpleSAML_Auth_Default { /* Save persistent authentication data. */ $persistentAuthState = array(); + + if (isset($state['IdP'])) { + /* For backwards compatibility. */ + $persistentAuthState['saml:sp:IdP'] = $state['IdP']; + } + if (isset($state['PersistentAuthData'])) { foreach ($state['PersistentAuthData'] as $key) { if (isset($state[$key])) { @@ -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; } @@ -105,20 +118,6 @@ class SimpleSAML_Auth_Default { /* Save session state. */ $session = SimpleSAML_Session::getInstance(); $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)) { /* Redirect... */ @@ -252,26 +251,6 @@ class SimpleSAML_Auth_Default { $session = SimpleSAML_Session::getInstance(); $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); }