Merge "Check existence of expires_in for auth" into stable/train

This commit is contained in:
Zuul 2021-01-31 08:36:45 +00:00 committed by Gerrit Code Review
commit 286b9aec88
1 changed files with 2 additions and 1 deletions

View File

@ -313,7 +313,8 @@ class RegistrySessionHelper(object):
if data and data.get('issued_at'):
token_time = dt_parse(data.get('issued_at'))
now = datetime.now(tzlocal())
if (now - token_time).seconds < data.get('expires_in'):
expires_in = data.get('expires_in')
if not expires_in or (now - token_time).seconds < expires_in:
return data['token']
return None