Eliminando middleware legado do Clerk e corrigindo rotas/controllers para Logto
This commit is contained in:
@@ -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 ')) {
|
||||
|
||||
Reference in New Issue
Block a user