Reorganize base modules

This commit is contained in:
François Voron
2019-10-10 19:21:36 +02:00
parent 9e1fd76f30
commit ef796abb55
9 changed files with 130 additions and 119 deletions

View File

@@ -1,18 +1,2 @@
from typing import Callable
from starlette.responses import Response
from fastapi_users.db import BaseUserDatabase
from fastapi_users.models import BaseUserDB
class BaseAuthentication:
"""Base adapter for generating and decoding authentication tokens."""
async def get_login_response(self, user: BaseUserDB, response: Response):
raise NotImplementedError()
def get_authentication_method(
self, user_db: BaseUserDatabase
) -> Callable[..., BaseUserDB]:
raise NotImplementedError()
from fastapi_users.authentication.base import BaseAuthentication # noqa: F401
from fastapi_users.authentication.jwt import JWTAuthentication # noqa: F401

View File

@@ -0,0 +1,18 @@
from typing import Callable
from starlette.responses import Response
from fastapi_users.db import BaseUserDatabase
from fastapi_users.models import BaseUserDB
class BaseAuthentication:
"""Base adapter for generating and decoding authentication tokens."""
async def get_login_response(self, user: BaseUserDB, response: Response):
raise NotImplementedError()
def get_authentication_method(
self, user_db: BaseUserDatabase
) -> Callable[..., BaseUserDB]:
raise NotImplementedError()

View File

@@ -6,8 +6,8 @@ from fastapi.security import OAuth2PasswordBearer
from starlette import status
from starlette.responses import Response
from fastapi_users.authentication import BaseAuthentication
from fastapi_users.db import BaseUserDatabase
from fastapi_users.authentication.base import BaseAuthentication
from fastapi_users.db.base import BaseUserDatabase
from fastapi_users.models import BaseUserDB
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="/login")