When calculating session_time, use the actual token life
This calculation uses the 'token_life' var which is a datetime.timedelta object. timedelta.seconds gets us just the 'seconds' component of the object, truncating away any days, hours, or weeks that might be included in the object. What we want here is the total time in seconds, which is total_seconds(). Closes-Bug: #1562452 Change-Id: I6a947abb891e1d34e1cf3aea53b345e0a804bacf
This commit is contained in:
@@ -263,7 +263,7 @@ class KeystoneBackend(object):
|
||||
request.user = user
|
||||
timeout = getattr(settings, "SESSION_TIMEOUT", 3600)
|
||||
token_life = user.token.expires - datetime.datetime.now(pytz.utc)
|
||||
session_time = min(timeout, token_life.seconds)
|
||||
session_time = min(timeout, int(token_life.total_seconds()))
|
||||
request.session.set_expiry(session_time)
|
||||
|
||||
scoped_client = keystone_client_class(session=session,
|
||||
|
||||
Reference in New Issue
Block a user