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
This commit is contained in:
@@ -11,15 +11,15 @@ export const isAuthenticated = async (event: any): Promise<boolean> => {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check Keycloak session authentication
|
||||
// Check OIDC session authentication
|
||||
try {
|
||||
const keycloakSession = getCookie(event, 'keycloak-session');
|
||||
if (keycloakSession) {
|
||||
console.log('[auth] Authenticated via Keycloak session');
|
||||
const oidcSession = getCookie(event, 'nuxt-oidc-auth');
|
||||
if (oidcSession) {
|
||||
console.log('[auth] Authenticated via OIDC session');
|
||||
return true;
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('[auth] Keycloak session check failed:', error);
|
||||
console.log('[auth] OIDC session check failed:', error);
|
||||
}
|
||||
|
||||
console.log('[auth] No valid authentication found');
|
||||
|
||||
Reference in New Issue
Block a user