From 82bafc06c9547b92cb934e2c523ee3363d451b30 Mon Sep 17 00:00:00 2001 From: Tomas Kracmar Date: Thu, 16 Apr 2026 11:32:45 +0200 Subject: [PATCH] fix(auth): resolve JWT InvalidSignatureError and improve frontend UX - Fix auth by using idToken fallback when accessToken audience mismatches - Add PyJWT verification with audience-aware token selection in frontend - Source health: track last_attempt_time and error status per source - Frontend: fix modal outside x-data scope, add circular-safe JSON stringify - Frontend: support multi-select service filter with All/None toggles - Frontend: improve filter layout into organized rows - Frontend: fix text overflow and result pill colors (success/succeeded) - Intune: normalize application actors (auditActorType=Application) - Add cache-control middleware for HTML/API responses - Update tests for multi-service filtering and source health --- .env.example | 5 +- backend/frontend/index.html | 213 ++++++++++++++++++++------------ backend/frontend/style.css | 128 ++++++++++++++++++- backend/main.py | 11 ++ backend/models/api.py | 1 + backend/models/event_model.py | 8 +- backend/routes/events.py | 3 + backend/routes/fetch.py | 3 +- backend/routes/health.py | 11 +- backend/sources/intune_audit.py | 23 ++-- backend/tests/test_api.py | 36 ++++++ backend/watermark.py | 11 +- 12 files changed, 350 insertions(+), 103 deletions(-) diff --git a/.env.example b/.env.example index c834846..842b998 100644 --- a/.env.example +++ b/.env.example @@ -6,7 +6,10 @@ FETCH_INTERVAL_MINUTES=60 AUTH_ENABLED=false AUTH_TENANT_ID=your-tenant-id AUTH_CLIENT_ID=your-api-client-id -# Optional scope for SPA login (e.g., api:///access_as_user) +# API scope the SPA should request at login. +# When set, the frontend acquires an access token for this scope (aud = AUTH_CLIENT_ID). +# When empty, the frontend falls back to the idToken, which is also valid for the backend. +# Example: api://cc31fd45-1eca-431f-a2c6-ba81cd4c5d50/.default AUTH_SCOPE= # Comma-separated lists (optional): AUTH_ALLOWED_ROLES= diff --git a/backend/frontend/index.html b/backend/frontend/index.html index eddb63c..f0a2ecf 100644 --- a/backend/frontend/index.html +++ b/backend/frontend/index.html @@ -4,7 +4,7 @@ AOC Events - + @@ -29,8 +29,10 @@ @@ -38,55 +40,73 @@
- - - - - - - - -
- - - - +
+ + + + +
+
+ + + +
+
+
+ App / Service +
+
+ + +
+
+ +
+
+
+
+
+
+ + + + +
@@ -98,35 +118,35 @@
-