14 lines
361 B
Python
14 lines
361 B
Python
|
from typing import Annotated
|
||
|
|
||
|
from fastapi import Depends, FastAPI
|
||
|
from fastapi.security import HTTPBasic, HTTPBasicCredentials
|
||
|
|
||
|
app = FastAPI()
|
||
|
|
||
|
security = HTTPBasic()
|
||
|
|
||
|
|
||
|
@app.get("/users/me")
|
||
|
def read_current_user(credentials: Annotated[HTTPBasicCredentials, Depends(security)]):
|
||
|
return {"username": credentials.username, "password": credentials.password}
|