From 63ef1179fc4dc3aed833313fc147d01c6e0be102 Mon Sep 17 00:00:00 2001 From: Thastertyn Date: Thu, 7 Mar 2024 07:51:58 +0100 Subject: [PATCH] Fix redis checking for token invalidation --- app/__init__.py | 2 ++ app/jwt_utils.py | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index c5f1e58..16aa9a6 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -14,4 +14,6 @@ def create_app(): from app.config import FlaskTesting, FlaskProduction app.config.from_object(FlaskTesting) + from . import jwt_utils + return app \ No newline at end of file diff --git a/app/jwt_utils.py b/app/jwt_utils.py index 2df5ae7..96f050c 100644 --- a/app/jwt_utils.py +++ b/app/jwt_utils.py @@ -2,11 +2,11 @@ from app.extensions import jwt_redis_blocklist from . import jwt_manager -@jwt.token_in_blocklist_loader +from app import app + +@jwt_manager.token_in_blocklist_loader def check_if_token_is_revoked(jwt_header, jwt_payload: dict) -> bool: jti = jwt_payload["jti"] token_in_redis = jwt_redis_blocklist.get(jti) - print(token_in_redis) - return token_in_redis is not None