Add shared_backend.authproxy: FastAPI AuthGuard-proxy engine

Extracted from three near-identical bespoke implementations (Heretic,
HordeWorker, InfiniteVideo), each ~800-1000 lines hand-rolling the same
status/setup/login/logout/TOTP/admin-user-CRUD proxy around AuthClient.
build_auth_router(get_client, get_store) returns a ready-to-mount
APIRouter matching shared/backend/auth (Go)'s Service response shapes.
Gated behind an optional `fastapi` extra so the rest of this
framework-agnostic package is unaffected. 18 new tests, including a
regression test for a real bug this had (request models nested inside
build_auth_router silently broke under `from __future__ import
annotations`, misrouting every JSON body as a missing query param).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Gabriel20xxandClaude Sonnet 5 committed 2026-09-13 21:27:54 +02:00
1 parent f58579290d
commit c09957189f
5 files changed
+995 -1

No files matched your search

+1 -1
View File
@@ -78,6 +78,6 @@ jobs:
with:
python-version: '3.12'
- name: Install package
run: python -m pip install --upgrade pip -e packages/python-backend
run: python -m pip install --upgrade pip -e "packages/python-backend[fastapi]"
- name: Run Python tests
run: python -m unittest discover -s packages/python-backend/tests -p 'test_*.py'