gwoe-antragspruefer/app
Dotty Dotter 7159240f49 #43 Keycloak SSO: JWT-Middleware + UI-Guiding
Auth-Schicht vorbereitet — Dev-Modus (KEYCLOAK_URL leer) lässt alles
durch, Prod-Modus (ENV gesetzt) validiert JWT gegen Keycloak-JWKS.

Backend (app/auth.py):
- JWKS-Cache mit 1h TTL (async httpx fetch)
- get_current_user: Optional, gibt User-Dict oder None
- require_auth: Pflicht, gibt User-Dict oder HTTP 401
- keycloak_login_url: Baut die OIDC-Login-URL
- _is_auth_enabled: prüft ob alle 3 ENV-Vars gesetzt sind

Abgesicherte POST-Endpoints:
- POST /analyze → Depends(require_auth)
- POST /api/analyze-drucksache → Depends(require_auth)
- POST /api/programme/index → Depends(require_auth)

Neue Endpoints:
- GET /api/auth/me → {authenticated, sub, email, name, roles} oder {authenticated: false}
- GET /api/auth/login-url → {enabled, url} für Keycloak-Redirect

Frontend (index.html):
- initAuth() beim DOMContentLoaded → prüft /api/auth/me
- "Anmelden"-Button im Header (neben "Quellen")
- "Jetzt prüfen"-Button: disabled + Tooltip "Nur nach Anmeldung
  verfügbar" wenn nicht eingeloggt; aktiv wenn eingeloggt
- currentUser-State steuert Button-Zustände

Dev-Modus: Solange KEYCLOAK_URL nicht gesetzt ist (lokale Dev, aktueller
Prod-Stand), sind alle Endpoints offen wie bisher. Kein Breaking Change.

Dependency: python-jose[cryptography]>=3.3.0 in requirements.txt.

Tests: 194/194 grün (auth.py hat keine Seiteneffekte im Import).

Refs: #43
2026-04-10 14:28:57 +02:00
..
kontext Activate LSA: Wahlprogramme + ingest + frontend (#2) 2026-04-07 22:12:32 +02:00
routers Initial commit: GWÖ-Antragsprüfer v1.0 2026-03-28 22:30:24 +01:00
static/referenzen Add 30 Wahlprogramme für TH/BB/HH/SH/BW/RP (#37, #39, #40, #32, #41, #42) 2026-04-09 08:03:11 +02:00
templates #43 Keycloak SSO: JWT-Middleware + UI-Guiding 2026-04-10 14:28:57 +02:00
__init__.py Initial commit: GWÖ-Antragsprüfer v1.0 2026-03-28 22:30:24 +01:00
analyzer.py #63 B+C: Force-Honesty + UI-Warning bei Score ohne Zitate 2026-04-10 09:32:31 +02:00
auswertungen.py Phase C: Auswertungen-Dashboard #58 + CSV-Export #45 (Roadmap #59) 2026-04-09 11:25:57 +02:00
auth.py #43 Keycloak SSO: JWT-Middleware + UI-Guiding 2026-04-10 14:28:57 +02:00
bundeslaender.py Phase J: SN EDAS-XML-Adapter (#26/#38) — Sachsen aktiv via XML-Export 2026-04-09 14:39:03 +02:00
config.py Initial commit: GWÖ-Antragsprüfer v1.0 2026-03-28 22:30:24 +01:00
database.py #47: Auto-Re-Analyse bei nicht-verifizierbaren Zitaten 2026-04-10 10:35:01 +02:00
embeddings.py #47: Auto-Re-Analyse bei nicht-verifizierbaren Zitaten 2026-04-10 10:35:01 +02:00
main.py #43 Keycloak SSO: JWT-Middleware + UI-Guiding 2026-04-10 14:28:57 +02:00
models.py Initial commit: GWÖ-Antragsprüfer v1.0 2026-03-28 22:30:24 +01:00
parlamente.py #23 BayernAdapter — TYPO3-Solr HTML scraping (Anträge in WP19) 2026-04-10 01:00:47 +02:00
parteien.py Phase J: SN EDAS-XML-Adapter (#26/#38) — Sachsen aktiv via XML-Export 2026-04-09 14:39:03 +02:00
report.py Security hotfixes #1, #2, #6 from audit (#57) 2026-04-09 10:45:43 +02:00
validators.py Phase A: Audit-Restbefunde #57.3/4/7 (Roadmap #59) 2026-04-09 11:15:16 +02:00
wahlperioden.py Phase C: Auswertungen-Dashboard #58 + CSV-Export #45 (Roadmap #59) 2026-04-09 11:25:57 +02:00
wahlprogramme.py Add 30 Wahlprogramme für TH/BB/HH/SH/BW/RP (#37, #39, #40, #32, #41, #42) 2026-04-09 08:03:11 +02:00