From cbead93e5ad21a5cadf3570613cd87fdcc171997 Mon Sep 17 00:00:00 2001 From: Taha Yassine Kraiem Date: Fri, 9 Aug 2024 14:34:41 +0100 Subject: [PATCH] fix(chalice): fixed Spot token generation --- api/chalicelib/core/users.py | 5 +++-- ee/api/chalicelib/core/users.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/api/chalicelib/core/users.py b/api/chalicelib/core/users.py index d13353a1c4..e520633fbc 100644 --- a/api/chalicelib/core/users.py +++ b/api/chalicelib/core/users.py @@ -647,12 +647,13 @@ def authenticate(email, password, for_change_password=False, include_spot=False) response = { **response, "spotJwt": authorizers.generate_jwt(user_id=r['userId'], tenant_id=r['tenantId'], - iat=j_r.spot_jwt_iat, aud=spot.AUDIENCE), + iat=j_r.spot_jwt_iat, aud=spot.AUDIENCE, for_spot=True), "spotRefreshToken": authorizers.generate_jwt_refresh(user_id=r['userId'], tenant_id=r['tenantId'], iat=j_r.spot_jwt_refresh_iat, aud=spot.AUDIENCE, - jwt_jti=j_r.spot_jwt_refresh_jti), + jwt_jti=j_r.spot_jwt_refresh_jti, + for_spot=True), "spotRefreshTokenMaxAge": config("JWT_SPOT_REFRESH_EXPIRATION", cast=int) } return response diff --git a/ee/api/chalicelib/core/users.py b/ee/api/chalicelib/core/users.py index ef54bf24ce..35afa65765 100644 --- a/ee/api/chalicelib/core/users.py +++ b/ee/api/chalicelib/core/users.py @@ -759,12 +759,13 @@ def authenticate(email, password, for_change_password=False, include_spot=False) if include_spot: response = {**response, "spotJwt": authorizers.generate_jwt(user_id=r['userId'], tenant_id=r['tenantId'], - iat=j_r.spot_jwt_iat, aud=spot.AUDIENCE), + iat=j_r.spot_jwt_iat, aud=spot.AUDIENCE, for_spot=True), "spotRefreshToken": authorizers.generate_jwt_refresh(user_id=r['userId'], tenant_id=r['tenantId'], iat=j_r.spot_jwt_refresh_iat, aud=spot.AUDIENCE, - jwt_jti=j_r.spot_jwt_refresh_jti), + jwt_jti=j_r.spot_jwt_refresh_jti, + for_spot=True), "spotRefreshTokenMaxAge": config("JWT_SPOT_REFRESH_EXPIRATION", cast=int), } return response