serve: add JWT consumer shim for bincio-auth integration

When --jwt-secret / BINCIO_AUTH_JWT_SECRET is set, auth is validated
locally by decoding the bincio-auth-issued JWT — no DB session lookup.
Falls back to existing DB-based session lookup when the flag is absent,
so standalone deployments keep working without any config change.

Changes:
- deps.py: add jwt_secret global, _decode_jwt helper, wire into
  _current_user and _require_auth
- cli.py: add --jwt-secret option; log active auth mode on startup
- pyproject.toml: add PyJWT>=2.8 to serve and dev extras
This commit is contained in:
Davide Scaini
2026-06-02 14:54:43 +02:00
parent 0d6bf57932
commit 2af29a460b
3 changed files with 48 additions and 20 deletions
+2
View File
@@ -42,6 +42,7 @@ serve = [
"uvicorn[standard]>=0.29",
"python-multipart>=0.0.9",
"bcrypt>=4.1",
"PyJWT>=2.8",
]
strava = [
"requests>=2.32",
@@ -79,6 +80,7 @@ dev = [
"uvicorn[standard]>=0.29",
"python-multipart>=0.0.9",
"bcrypt>=4.1",
"PyJWT>=2.8",
"httpx>=0.28.1",
]