INNER CODE UNIT · Python

check_if_token_in_denylist

Yacht-sh/Yacht · backend/api/main.py:76

def check_if_token_in_denylist(decrypted_token):
    db = SessionLocal()
    try:
        jti = decrypted_token["jti"]
        entry = db.query(TokenBlacklist).filter(TokenBlacklist.jti == jti).first()
        return entry is not None
    finally:
        db.close()


@app.exception_handler(AuthJWTException)
def authjwt_exception_handler(request: Request, exc: AuthJWTException):
    status_code = exc.status_code
    if (
        exc.message == "Signature verification failed"
        or exc.message == "Signature has expired"
    ):
        status_code = 401

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…