From 262de901a855ceb8e2877868f6452473e15b6c4b Mon Sep 17 00:00:00 2001 From: Maxime Alves LIRMM Date: Mon, 13 Feb 2023 11:14:24 +0100 Subject: [PATCH] =?UTF-8?q?[jwtMiddleware]=C2=A0on=20expired=20signature?= =?UTF-8?q?=20error,=20returns=20Nobody=20and=20do=20not=20raise=20an=20ex?= =?UTF-8?q?ception?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- halfapi/lib/jwt_middleware.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/halfapi/lib/jwt_middleware.py b/halfapi/lib/jwt_middleware.py index 4c021f2..136d632 100644 --- a/halfapi/lib/jwt_middleware.py +++ b/halfapi/lib/jwt_middleware.py @@ -102,6 +102,8 @@ class JWTAuthenticationBackend(AuthenticationBackend): raise AuthenticationError( 'Trying to connect using *DEBUG* token in *PRODUCTION* mode') + except jwt.ExpiredSignatureError as exc: + return AuthCredentials(), Nobody() except jwt.InvalidTokenError as exc: raise AuthenticationError(str(exc)) from exc except Exception as exc: