Commit Graph

5 Commits

Author SHA1 Message Date
Matt 536e544d04 DEBUG: Add detailed OIDC cookie debugging for file preview issues
- Added logging for OIDC session presence and type detection
- Will help identify why OIDC cookies aren't being sent during file preview requests
- Keycloak login works but file previews fail due to missing OIDC cookie
2025-06-15 17:06:01 +02:00
Matt d45ae31f10 FEAT: Unified Authentication System - Support Both Directus and Keycloak Users
**Problem Solved:**
- File previews failing due to unsupported Directus authentication
- Encrypted OIDC cookies causing JSON parse errors
- Need both Directus and Keycloak users to access same dashboard

**Changes:**
- server/utils/auth.ts: Added Directus token validation alongside OIDC
- server/api/auth/session.ts: Support both auth methods with proper user data
- server/api/auth/logout.ts: Clear appropriate cookies based on auth method

**Authentication Methods Now Supported:**
1. X-tag headers (webhooks/external calls)
2. Directus tokens (existing Directus users)
3. OIDC sessions (Keycloak users, encrypted or plain)

**Result:**
- Both Directus and Keycloak users can access dashboard
- File previews work for all authenticated users
- Proper logout handling for each auth method
- No more JSON parse errors for encrypted OIDC cookies
2025-06-15 17:03:42 +02:00
Matt 7ca77e2dcf FIX: Correct OIDC cookie name mismatch across all auth endpoints
**Root Cause:**
- Auth system was looking for 'keycloak-session' cookies
- But actual OIDC system uses 'nuxt-oidc-auth' cookies
- This caused authentication failures for file previews and other endpoints

**Files Updated:**
- server/utils/auth.ts: Updated to check 'nuxt-oidc-auth' cookie
- server/api/auth/session.ts: Updated cookie name references
- server/api/auth/logout.ts: Updated cookie deletion
- server/api/auth/keycloak/callback.ts: Updated cookie creation

**Result:**
- File previews should now work for authenticated users
- All authentication endpoints now use consistent cookie names
- Both x-tag headers and OIDC sessions work correctly
2025-06-15 16:58:45 +02:00
Matt 6c1a1fa842 DEBUG: Add auth debugging logs to identify file preview auth issue 2025-06-15 16:53:20 +02:00
Matt 01b770dc6c FIX: Authentication for Keycloak - Phase 1
Updated core interest management endpoints:
-  server/api/create-interest.ts
-  server/api/update-interest.ts
-  server/api/delete-interest.ts
-  Created server/utils/auth.ts with dual auth support

 Next: Update ALL remaining API endpoints systematically
2025-06-15 16:13:22 +02:00