Eliminando middleware legado do Clerk e corrigindo rotas/controllers para Logto

This commit is contained in:
2026-03-31 10:52:42 +00:00
parent b6900e8b3c
commit eb560596bd
26 changed files with 29 additions and 208 deletions

View File

@@ -1,19 +1,14 @@
import { createRemoteJWKSet, jwtVerify } from 'jose';
import { supabase, findOneGpi } from '../config/supabase.js';
import { IAppUser } from './authMiddleware.js';
const LOGTO_URL = process.env.LOGTO_URL || 'https://logto-admin-bzlued1boxl3t8ewsyn99an9.187.77.227.172.sslip.io';
const APP_ID = process.env.LOGTO_APP_ID || 'gpi-app-001';
const jwks = createRemoteJWKSet(new URL(`${LOGTO_URL}/oidc/jwks`));
export interface AppUser {
id: string;
logtoId: string;
email: string;
name: string;
role: string;
}
export type AppUser = IAppUser;
export async function authenticateRequest(req: any): Promise<AppUser | null> {
export async function authenticateRequest(req: any): Promise<IAppUser | null> {
const authHeader = req.headers.authorization;
if (!authHeader?.startsWith('Bearer ')) {