-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauth.py
More file actions
33 lines (20 loc) · 940 Bytes
/
auth.py
File metadata and controls
33 lines (20 loc) · 940 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from fastapi import APIRouter
auth_router = APIRouter(prefix="/auth", tags=["auth"])
@auth_router.get("/basic-auth/{user}/{passwd}")
async def get_auth_basic_auth(user, passwd):
return {user: passwd}
@auth_router.get("/bearer")
async def get_auth_bearer():
return "/bearer"
@auth_router.get("/digest-auth/{qop}/{user}/{passwd}")
async def get_auth_digest_auth(qop, user, passwd):
return qop, user, passwd
@auth_router.get("/digest-auth/{qop}/{user}/{passwd}/{algorithm}")
async def get_auth_diget_auth_a(qop, user, passwd, algorithm):
return qop, user, passwd, algorithm
@auth_router.get("/digest-auth/{qop}/{user}/{passwd}/{algorithm}/{stale_after}")
async def get_auth_diget_auth_a_s(qop, user, passwd, algorithm, stale_after):
return qop, user, passwd, algorithm, stale_after
@auth_router.get("/hidden-basic-auth/{user}/{passwd}")
async def get_hidden_basic_auth(user, passwd):
return {user: passwd}