Inject a user manager dep callable directly to FastAPIUsers

This commit is contained in:
François Voron
2021-09-14 14:39:59 +02:00
parent 480a6bc4df
commit 8967138375
16 changed files with 54 additions and 88 deletions

View File

@@ -8,7 +8,7 @@ from pydantic import UUID4
from fastapi_users import models
from fastapi_users.authentication import BaseAuthentication
from fastapi_users.jwt import SecretType, decode_jwt, generate_jwt
from fastapi_users.manager import UserManager, UserNotExists
from fastapi_users.manager import BaseUserManager, UserNotExists
class CookieAuthentication(
@@ -69,7 +69,7 @@ class CookieAuthentication(
async def __call__(
self,
credentials: Optional[str],
user_manager: UserManager[models.UC, models.UD],
user_manager: BaseUserManager[models.UC, models.UD],
) -> Optional[models.UD]:
if credentials is None:
return None