From 1741cb5262181182129fd3c9b27cdace7d34dd31 Mon Sep 17 00:00:00 2001 From: tangy5 <58751975+tangy5@users.noreply.github.com> Date: Thu, 16 May 2024 23:52:11 -0700 Subject: [PATCH] Jwt package for 0.8.2 (#1690) * change to pyjwt replace josejwt Signed-off-by: tangy5 * change to pyjwt replace josejwt Signed-off-by: tangy5 * change to pyjwt replace josejwt Signed-off-by: tangy5 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Signed-off-by: tangy5 Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- monailabel/endpoints/user/auth.py | 5 +++-- requirements.txt | 2 +- setup.cfg | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/monailabel/endpoints/user/auth.py b/monailabel/endpoints/user/auth.py index 030c6bc7d..2abc0150f 100644 --- a/monailabel/endpoints/user/auth.py +++ b/monailabel/endpoints/user/auth.py @@ -11,11 +11,12 @@ import logging from typing import List, Sequence, Union +import jwt import requests from cachetools import cached from fastapi import Depends, HTTPException, Security, status from fastapi.security import OAuth2PasswordBearer -from jose import JWTError, jwt +from jwt import InvalidTokenError from passlib.context import CryptContext from pydantic import BaseModel @@ -114,7 +115,7 @@ async def get_current_user(token: str = Depends(oauth2_scheme) if settings.MONAI ) try: return from_token(token) - except JWTError as e: + except InvalidTokenError as e: logger.error(e) raise credentials_exception diff --git a/requirements.txt b/requirements.txt index 4887249dc..40c6d9ee0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -35,7 +35,7 @@ einops==0.7.0 pyyaml==6.0.1 filelock==3.11.0 passlib==1.7.4 -python-jose[cryptography]==3.3.0 +pyjwt==2.8.0 bcrypt==4.1.2 shapely==2.0.4 requests==2.31.0 diff --git a/setup.cfg b/setup.cfg index f360a6fce..01d3413f8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -61,7 +61,7 @@ install_requires = pyyaml==6.0.1 filelock==3.11.0 passlib==1.7.4 - python-jose[cryptography]==3.3.0 + pyjwt==2.8.0 bcrypt==4.1.2 shapely==2.0.4 requests==2.31.0