Fix horizon user session timeout

Made changes so that the date to expire (when the user will be logged
out) is based on the time the user logged in and not the time that the
user last interacted with Horizon.

Story: 2002862
Task: 22811

This is related to
https://git.openstack.org/cgit/openstack/stx-integ/commit/?id=f1400b9b4867553f8fa8aab09d832dec2fdcecde

Change-Id: I568f8e467847826e1638eb609752b74fc463633d
Signed-off-by: Don Penney <don.penney@windriver.com>
Signed-off-by: Jack Ding <jack.ding@windriver.com>
This commit is contained in:
Kristine Bujold 2018-06-18 17:13:03 -04:00 committed by Jack Ding
parent 07d87406ee
commit 92afe0a11b
3 changed files with 52 additions and 0 deletions

View File

@ -4,3 +4,4 @@
0004-meta-disable-token-validation-per-auth-req.patch
0005-meta-cache-authorized-tenants-in-cookie-to-improve-performance.patch
0006-meta-Distributed-Keystone.patch
spec-include-fix_for_session_timeout.patch

View File

@ -0,0 +1,24 @@
From 2ba11680cdbdf309122e0ad2d624e768deba8ec5 Mon Sep 17 00:00:00 2001
From: Kristine Bujold <kristine.bujold@windriver.com>
Date: Wed, 6 Jun 2018 08:02:32 -0400
Subject: [PATCH 1/1] Adding patch file
---
SPECS/python-django-openstack-auth.spec | 1 +
1 file changed, 1 insertion(+)
diff --git a/SPECS/python-django-openstack-auth.spec b/SPECS/python-django-openstack-auth.spec
index f925d87..9e5aacb 100644
--- a/SPECS/python-django-openstack-auth.spec
+++ b/SPECS/python-django-openstack-auth.spec
@@ -19,6 +19,7 @@ Patch0001: 0001-Pike-rebase-for-openstack-auth.patch
Patch0002: 0002-disable-token-validation-per-auth-request.patch
Patch0003: 0003-cache-authorized-tenants-in-cookie-to-improve-performance.patch
Patch0004: 0004-Distributed-Keystone.patch
+Patch0005: fix_for_session_timeout.patch
BuildArch: noarch
--
1.8.3.1

View File

@ -0,0 +1,27 @@
From ff48b415941e51f02ba7f9377ba3f9225721bfe1 Mon Sep 17 00:00:00 2001
From: Kristine Bujold <kristine.bujold@windriver.com>
Date: Wed, 6 Jun 2018 07:53:59 -0400
Subject: [PATCH 1/1] Fix horizon user session timeout
---
openstack_auth/views.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/openstack_auth/views.py b/openstack_auth/views.py
index ad339c4..a680abf 100644
--- a/openstack_auth/views.py
+++ b/openstack_auth/views.py
@@ -122,6 +122,10 @@ def login(request, template_name=None, extra_context=None, **kwargs):
region_name = regions.get(login_region)
request.session['region_endpoint'] = region
request.session['region_name'] = region_name
+
+ # Adding the user's last_login to the session
+ request.session['_user_login'] = request.user.last_login
+
expiration_time = request.user.time_until_expiration()
threshold_days = getattr(
settings, 'PASSWORD_EXPIRES_WARNING_THRESHOLD_DAYS', -1)
--
1.8.3.1