mime fix
This commit is contained in:
0
bearer/__init__.py
Normal file
0
bearer/__init__.py
Normal file
13
bearer/models/token.py
Normal file
13
bearer/models/token.py
Normal file
@ -0,0 +1,13 @@
|
||||
from typing import Optional, Union
|
||||
|
||||
from sqlmodel import Field, SQLModel, Session, select
|
||||
from db.DB import DB, DBException
|
||||
|
||||
|
||||
class Token(SQLModel):
|
||||
access_token: str
|
||||
token_type: str
|
||||
|
||||
|
||||
class TokenData(SQLModel):
|
||||
username: Union[str, None] = None
|
17
bearer/routes/auth.py
Normal file
17
bearer/routes/auth.py
Normal file
@ -0,0 +1,17 @@
|
||||
from fastapi import APIRouter, Depends
|
||||
from typing import Annotated, Union
|
||||
import secrets
|
||||
from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
|
||||
|
||||
|
||||
auth = APIRouter()
|
||||
|
||||
|
||||
@auth.get("/create_secret_key/")
|
||||
async def create_secret_key():
|
||||
return {"key": secrets.token_hex(32)}
|
||||
|
||||
|
||||
@auth.post("/token")
|
||||
async def login(form_data: Annotated[OAuth2PasswordRequestForm, Depends()]):
|
||||
pass
|
Reference in New Issue
Block a user