Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /codemation_easyauth /tests /test_client.py
| from typing import Optional | |
| from fastapi import FastAPI | |
| from easyauth.client import EasyAuthClient | |
| from easyauth.pages import NotFoundPage | |
| server = FastAPI(openapi_url="/groups/openapi.json") | |
| server.auth = EasyAuthClient.create( | |
| server, | |
| "http://0.0.0.0:8520/auth/token", # Should be a running EasyAuthServer | |
| auth_secret="abcd1234", | |
| default_login_path="/login", | |
| ) | |
| # grants access to only specified users | |
| async def root(): | |
| return "I am root" | |
| # grants access to members of 'users' or 'admins' group. | |
| async def groups(): | |
| return "I am groups" | |
| # grants access to all members of group which a role of 'basic' or advanced, or member 'users' group | |
| async def roles(): | |
| return "I am roles" | |
| # grants access to all members of groups with a roles granting 'BASIC_CREATE' | |
| # accesssing the auth token | |
| async def action(access_token: Optional[str] = None): | |
| return f"I am actions with token {access_token}" | |
| def unimplemented_not_found(): | |
| return f"TODO - not found" | |
Xet Storage Details
- Size:
- 1.29 kB
- Xet hash:
- cc87a8635ab98360866dc57326c42c9d220e02477d9af4e52bd1f573d97ed84f
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.