Files
nucleoWhisper/nuxt4/server/api/auth/status.get.ts
josedario87 6439ff8f60
Some checks failed
build-and-deploy / build (push) Failing after 5s
build-and-deploy / deploy (push) Has been skipped
Implementación inicial de Nucleo Whisper
- Configurado proyecto Nuxt 4 con PWA
- Integrado OpenAI Whisper API para transcripción de audio
- Implementada captura de audio desde navegador
- Creada UI con grabación y visualización de transcripciones
- Configurado Authentik Proxy para autenticación
- Setup de Docker y Gitea Actions para despliegue
2025-10-13 14:33:04 -06:00

44 lines
1.1 KiB
TypeScript

/**
* API endpoint para verificar el estado de autenticación en tiempo real
* Consulta los headers inyectados por Authentik Proxy Outpost
*/
export default defineEventHandler((event) => {
// Establecer headers para prevenir caching
setResponseHeaders(event, {
'Cache-Control': 'no-store, no-cache, must-revalidate, proxy-revalidate',
'Pragma': 'no-cache',
'Expires': '0'
})
// Leer headers de Authentik en tiempo real
const headers = getHeaders(event)
const username = headers['x-authentik-username']
const email = headers['x-authentik-email']
const name = headers['x-authentik-name']
const groups = headers['x-authentik-groups']
const uid = headers['x-authentik-uid']
// Si no hay username, no hay sesión activa en Authentik
if (!username) {
return {
authenticated: false,
user: null,
timestamp: new Date().toISOString()
}
}
// Sesión activa
return {
authenticated: true,
user: {
username,
email,
name,
groups: groups ? groups.split('|') : [],
uid
},
timestamp: new Date().toISOString()
}
})