* 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
This commit is contained in:
Kraiem Taha Yassine 2024-08-30 13:44:22 +02:00 committed by GitHub
parent a7c68b751b
commit ed390daef8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 5 additions and 10 deletions

View file

@ -32,6 +32,7 @@ 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)
@ -45,6 +46,8 @@ class JWTAuth(HTTPBearer):
raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST,
detail="Invalid authentication scheme.")
jwt_payload = authorizers.jwt_authorizer(scheme=credentials.scheme, token=credentials.credentials)
logger.info("------ jwt_payload ------")
logger.info(jwt_payload)
auth_exists = jwt_payload is not None and users.auth_exists(user_id=jwt_payload.get("userId", -1),
jwt_iat=jwt_payload.get("iat", 100))
if jwt_payload is None \

View file

@ -9,14 +9,6 @@ from chalicelib.utils.TimeUTC import TimeUTC
logger = logging.getLogger(__name__)
logger.info("--------- authorizer config ---------")
logger.info(f'JWT_REFRESH_EXPIRATION:{config("JWT_REFRESH_EXPIRATION", cast=int)}')
logger.info(f'JWT_SPOT_REFRESH_EXPIRATION:{config("JWT_SPOT_REFRESH_EXPIRATION", cast=int)}')
logger.info(f'JWT_ISSUER:{config("JWT_ISSUER")}')
logger.info(f'JWT_REFRESH_SECRET:{config("JWT_REFRESH_SECRET")}')
logger.info(f'JWT_SPOT_REFRESH_SECRET:{config("JWT_SPOT_REFRESH_SECRET")}')
logger.info("--------- authorizer config ---------")
def get_supported_audience():
return [users.AUDIENCE, spot.AUDIENCE]

View file

@ -525,7 +525,7 @@ def get_by_invitation_token(token, pass_token=None):
return helper.dict_to_camel_case(r)
def auth_exists(user_id, jwt_iat):
def auth_exists(user_id, jwt_iat) -> bool:
with pg_client.PostgresClient() as cur:
cur.execute(
cur.mogrify(f"""SELECT user_id, EXTRACT(epoch FROM jwt_iat)::BIGINT AS jwt_iat

View file

@ -608,7 +608,7 @@ def get_by_invitation_token(token, pass_token=None):
return helper.dict_to_camel_case(r)
def auth_exists(user_id, tenant_id, jwt_iat):
def auth_exists(user_id, tenant_id, jwt_iat) -> bool:
with pg_client.PostgresClient() as cur:
cur.execute(
cur.mogrify(