diff --git a/swh/auth/django/utils.py b/swh/auth/django/utils.py --- a/swh/auth/django/utils.py +++ b/swh/auth/django/utils.py @@ -80,8 +80,7 @@ user = oidc_user_from_decoded_token(decoded_token, client_id=oidc_client.client_id) # get authentication init datetime - auth_time = decoded_token.get("auth_time", decoded_token["iat"]) - auth_datetime = datetime.fromtimestamp(auth_time) + auth_datetime = datetime.fromtimestamp(decoded_token["iat"]) exp_datetime = datetime.fromtimestamp(decoded_token["exp"]) # compute OIDC tokens expiration date diff --git a/swh/auth/pytest_plugin.py b/swh/auth/pytest_plugin.py --- a/swh/auth/pytest_plugin.py +++ b/swh/auth/pytest_plugin.py @@ -102,17 +102,13 @@ if userinfo is not None: decoded = {**decoded, **userinfo} # tweak auth and exp time for tests - auth_time = decoded.get("auth_time", decoded["iat"]) - expire_in = decoded["exp"] - auth_time + expire_in = decoded["exp"] - decoded["iat"] if self.exp is not None: decoded["exp"] = self.exp - auth_time = self.exp - expire_in - decoded["iat"] = auth_time - decoded["auth_time"] = auth_time + decoded["iat"] = self.exp - expire_in else: now = int(datetime.now(tz=timezone.utc).timestamp()) decoded["iat"] = now - decoded["auth_time"] = now decoded["exp"] = now + expire_in decoded["groups"] = self.user_groups decoded["aud"] = [self.client_id, "account"]