From 10430e21a60a695c0f4f4635331264d3b8959cf6 Mon Sep 17 00:00:00 2001 From: Kraiem Taha Yassine Date: Fri, 30 Aug 2024 15:43:05 +0200 Subject: [PATCH] Dev (#2518) * fix(chalice): fixed Math-operators validation refactor(chalice): search for sessions that have events for heatmaps * refactor(chalice): search for sessions that have at least 1 location event for heatmaps * fix(chalice): fixed Math-operators validation refactor(chalice): search for sessions that have events for heatmaps * refactor(chalice): search for sessions that have at least 1 location event for heatmaps * feat(chalice): autocomplete return top 10 with stats * fix(chalice): fixed autocomplete top 10 meta-filters * debug(chalice): debugging spot login/refresh --- api/auth/auth_jwt.py | 2 +- api/chalicelib/core/authorizers.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/api/auth/auth_jwt.py b/api/auth/auth_jwt.py index 9210ec5a9..fd4d145b1 100644 --- a/api/auth/auth_jwt.py +++ b/api/auth/auth_jwt.py @@ -32,7 +32,6 @@ class JWTAuth(HTTPBearer): super(JWTAuth, self).__init__(auto_error=auto_error) async def __call__(self, request: Request) -> Optional[schemas.CurrentContext]: - logger.info(request.url.path) if request.url.path in ["/refresh", "/api/refresh"]: return await self.__process_refresh_call(request) @@ -121,6 +120,7 @@ class JWTAuth(HTTPBearer): jwt_payload = None else: jwt_payload = authorizers.jwt_refresh_authorizer(scheme="Bearer", token=request.cookies["spotRefreshToken"]) + logger.info("__process_spot_refresh_call") logger.info(jwt_payload) if jwt_payload is None or jwt_payload.get("jti") is None: logger.warning("Null spotRefreshToken's payload, or null JTI.") diff --git a/api/chalicelib/core/authorizers.py b/api/chalicelib/core/authorizers.py index c8aa311ec..e4c9de352 100644 --- a/api/chalicelib/core/authorizers.py +++ b/api/chalicelib/core/authorizers.py @@ -17,11 +17,13 @@ def get_supported_audience(): def is_spot_token(token: str) -> bool: try: decoded_token = jwt.decode(token, options={"verify_signature": False, "verify_exp": False}) + logger.info("---- is spot token ----") logger.info(decoded_token) audience = decoded_token.get("aud") + logger.info(f"{audience} == {spot.AUDIENCE} = {audience == spot.AUDIENCE}") return audience == spot.AUDIENCE except jwt.InvalidTokenError: - logger.error(f"Invalid token: {token}") + logger.error(f"Invalid token for is_spot_token: {token}") raise