diff --git a/antarest/eventbus/web.py b/antarest/eventbus/web.py index d316fa0c94..481db7b371 100644 --- a/antarest/eventbus/web.py +++ b/antarest/eventbus/web.py @@ -18,6 +18,7 @@ from typing import List, Optional from fastapi import Depends, FastAPI, HTTPException, Query +from fastapi_jwt_auth import AuthJWT # type: ignore from pydantic import BaseModel from starlette.websockets import WebSocket, WebSocketDisconnect @@ -27,7 +28,6 @@ from antarest.core.model import PermissionInfo, StudyPermissionType from antarest.core.permissions import check_permission from antarest.login.auth import Auth -from fastapi_jwt_auth import AuthJWT # type: ignore logger = logging.getLogger(__name__) diff --git a/antarest/login/auth.py b/antarest/login/auth.py index 615dc7e170..6cd2a3139f 100644 --- a/antarest/login/auth.py +++ b/antarest/login/auth.py @@ -16,13 +16,13 @@ from typing import Any, Callable, Coroutine, Dict, Optional, Tuple, Union from fastapi import Depends +from fastapi_jwt_auth import AuthJWT # type: ignore from pydantic import BaseModel from ratelimit.types import Scope # type: ignore from starlette.requests import Request from antarest.core.config import Config from antarest.core.jwt import DEFAULT_ADMIN_USER, JWTUser -from fastapi_jwt_auth import AuthJWT # type: ignore logger = logging.getLogger(__name__) diff --git a/antarest/login/main.py b/antarest/login/main.py index b0b96c760a..fe1acea550 100644 --- a/antarest/login/main.py +++ b/antarest/login/main.py @@ -15,6 +15,7 @@ from typing import Any, Optional from fastapi import FastAPI +from fastapi_jwt_auth import AuthJWT # type: ignore from fastapi_jwt_auth.exceptions import AuthJWTException # type: ignore from starlette.requests import Request from starlette.responses import JSONResponse @@ -26,7 +27,6 @@ from antarest.login.repository import BotRepository, GroupRepository, RoleRepository, UserLdapRepository, UserRepository from antarest.login.service import LoginService from antarest.login.web import create_login_api -from fastapi_jwt_auth import AuthJWT # type: ignore def build_login( diff --git a/antarest/login/web.py b/antarest/login/web.py index 508db2b77a..8f98012529 100644 --- a/antarest/login/web.py +++ b/antarest/login/web.py @@ -16,6 +16,7 @@ from typing import Any, List, Optional, Union from fastapi import APIRouter, Depends, HTTPException +from fastapi_jwt_auth import AuthJWT # type: ignore from markupsafe import escape from pydantic import BaseModel @@ -41,7 +42,6 @@ UserInfo, ) from antarest.login.service import LoginService -from fastapi_jwt_auth import AuthJWT # type: ignore logger = logging.getLogger(__name__) diff --git a/antarest/main.py b/antarest/main.py index 5b3ea2cb18..c5e4d30197 100644 --- a/antarest/main.py +++ b/antarest/main.py @@ -23,6 +23,7 @@ from fastapi import FastAPI, HTTPException from fastapi.encoders import jsonable_encoder from fastapi.exceptions import RequestValidationError +from fastapi_jwt_auth import AuthJWT # type: ignore from ratelimit import RateLimitMiddleware # type: ignore from ratelimit.backends.redis import RedisBackend # type: ignore from ratelimit.backends.simple import MemoryBackend # type: ignore @@ -53,7 +54,6 @@ from antarest.study.storage.rawstudy.watcher import Watcher from antarest.tools.admin_lib import clean_locks from antarest.utils import SESSION_ARGS, Module, create_services, init_db_engine -from fastapi_jwt_auth import AuthJWT # type: ignore logger = logging.getLogger(__name__) diff --git a/antarest/utils.py b/antarest/utils.py index 60f520f2e7..8c9b0dea70 100644 --- a/antarest/utils.py +++ b/antarest/utils.py @@ -20,6 +20,7 @@ import sqlalchemy.ext.baked # type: ignore import uvicorn # type: ignore from fastapi import FastAPI +from fastapi_jwt_auth import AuthJWT # type: ignore from ratelimit import RateLimitMiddleware # type: ignore from ratelimit.backends.redis import RedisBackend # type: ignore from ratelimit.backends.simple import MemoryBackend # type: ignore @@ -53,7 +54,6 @@ from antarest.worker.archive_worker import ArchiveWorker from antarest.worker.simulator_worker import SimulatorWorker from antarest.worker.worker import AbstractWorker -from fastapi_jwt_auth import AuthJWT # type: ignore logger = logging.getLogger(__name__) diff --git a/tests/login/test_web.py b/tests/login/test_web.py index 78e605d25b..fe1cda2230 100644 --- a/tests/login/test_web.py +++ b/tests/login/test_web.py @@ -19,6 +19,7 @@ import pytest from fastapi import FastAPI +from fastapi_jwt_auth import AuthJWT from starlette.testclient import TestClient from antarest.core.config import Config, SecurityConfig @@ -41,7 +42,6 @@ UserInfo, ) from antarest.main import JwtSettings -from fastapi_jwt_auth import AuthJWT PARAMS = RequestParameters( user=JWTUser( diff --git a/tests/matrixstore/test_web.py b/tests/matrixstore/test_web.py index 920a832f5c..2879b07bf4 100644 --- a/tests/matrixstore/test_web.py +++ b/tests/matrixstore/test_web.py @@ -15,13 +15,13 @@ import pytest from fastapi import FastAPI +from fastapi_jwt_auth import AuthJWT from starlette.testclient import TestClient from antarest.core.config import Config, SecurityConfig from antarest.main import JwtSettings from antarest.matrixstore.main import build_matrix_service from antarest.matrixstore.model import MatrixDTO, MatrixInfoDTO -from fastapi_jwt_auth import AuthJWT from tests.login.test_web import create_auth_token