[jwtMiddleware] on expired signature error, returns Nobody and do not raise an exception

This commit is contained in:
Maxime Alves LIRMM 2023-02-13 11:14:24 +01:00
parent e5c25ede1f
commit 262de901a8
1 changed files with 2 additions and 0 deletions

View File

@ -102,6 +102,8 @@ class JWTAuthenticationBackend(AuthenticationBackend):
raise AuthenticationError( raise AuthenticationError(
'Trying to connect using *DEBUG* token in *PRODUCTION* mode') 'Trying to connect using *DEBUG* token in *PRODUCTION* mode')
except jwt.ExpiredSignatureError as exc:
return AuthCredentials(), Nobody()
except jwt.InvalidTokenError as exc: except jwt.InvalidTokenError as exc:
raise AuthenticationError(str(exc)) from exc raise AuthenticationError(str(exc)) from exc
except Exception as exc: except Exception as exc: