|
|
@ -200,11 +200,17 @@ def _get_luci_context_access_token(env, now):
|
|
|
|
if expiry:
|
|
|
|
if expiry:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
expiry_dt = datetime.datetime.utcfromtimestamp(expiry)
|
|
|
|
expiry_dt = datetime.datetime.utcfromtimestamp(expiry)
|
|
|
|
|
|
|
|
logging.debug(
|
|
|
|
|
|
|
|
'local_auth: got an access token for '
|
|
|
|
|
|
|
|
'account "%s" that expires in %d sec',
|
|
|
|
|
|
|
|
account_id, (expiry_dt - now).total_seconds())
|
|
|
|
except (TypeError, ValueError):
|
|
|
|
except (TypeError, ValueError):
|
|
|
|
authErr('Invalid expiry in returned token')
|
|
|
|
authErr('Invalid expiry in returned token')
|
|
|
|
logging.debug(
|
|
|
|
else:
|
|
|
|
'local_auth: got an access token for account "%s" that expires in %d sec',
|
|
|
|
logging.debug(
|
|
|
|
account_id, expiry - time.mktime(now.timetuple()))
|
|
|
|
'local auth: got an access token for '
|
|
|
|
|
|
|
|
'account "%s" that does not expire',
|
|
|
|
|
|
|
|
account_id)
|
|
|
|
access_token = AccessToken(access_token, expiry_dt)
|
|
|
|
access_token = AccessToken(access_token, expiry_dt)
|
|
|
|
if _needs_refresh(access_token, now=now):
|
|
|
|
if _needs_refresh(access_token, now=now):
|
|
|
|
authErr('local_auth: the returned access token needs to be refreshed')
|
|
|
|
authErr('local_auth: the returned access token needs to be refreshed')
|
|
|
|