SSO: Skip redundant session update

This commit is contained in:
Aleksander Machniak 2018-11-27 12:01:22 +01:00
parent 3c0d00ef67
commit cf50715f4f

View file

@ -25,6 +25,7 @@ class kolab_sso extends rcube_plugin
public $rc;
private $data;
private $old_data;
private $driver;
private $debug = false;
@ -90,6 +91,8 @@ class kolab_sso extends rcube_plugin
) {
$driver = $this->get_driver($mode);
$this->old_data = $data;
// Session validation, token refresh, etc.
if ($this->data = $driver->validate_session($data)) {
// register storage connection hooks
@ -176,7 +179,10 @@ class kolab_sso extends rcube_plugin
{
// Between startup and authenticate the session is destroyed.
// So, we save the data later than that.
if (!empty($this->data) && !empty($_SESSION['user_id'])) {
if (!empty($this->data) && !empty($_SESSION['user_id'])
// update session only when data changed
&& (empty($this->old_data) || $this->old_data != $this->data)
) {
$_SESSION['sso_data'] = $this->rc->encrypt(json_encode($this->data));
}
}