feat: optimize token verification
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import time
|
||||
import traceback
|
||||
|
||||
import jwt
|
||||
from fastapi import FastAPI, HTTPException
|
||||
from passlib.exc import InvalidTokenError
|
||||
from starlette import status
|
||||
@@ -65,6 +66,12 @@ def add_app_middlewares(app: FastAPI):
|
||||
raise unauthorized_exception
|
||||
except InvalidTokenError:
|
||||
raise unauthorized_exception
|
||||
except jwt.exceptions.InvalidSignatureError:
|
||||
raise unauthorized_exception
|
||||
except jwt.exceptions.ExpiredSignatureError:
|
||||
raise unauthorized_exception
|
||||
except jwt.exceptions.DecodeError:
|
||||
raise unauthorized_exception
|
||||
|
||||
async def get_default_cache_value():
|
||||
async with async_session() as session:
|
||||
|
||||
Reference in New Issue
Block a user