Fix typescript any type in logtoAuth.ts causing deploy failure
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import { Request, Response, NextFunction } from 'express';
|
||||||
import { createRemoteJWKSet, jwtVerify } from 'jose';
|
import { createRemoteJWKSet, jwtVerify } from 'jose';
|
||||||
import { supabase, findOneGpi } from '../config/supabase.js';
|
import { supabase, findOneGpi } from '../config/supabase.js';
|
||||||
import { IAppUser } from './authMiddleware.js';
|
import { IAppUser } from './authMiddleware.js';
|
||||||
@@ -8,7 +9,7 @@ const jwks = createRemoteJWKSet(new URL(`${LOGTO_URL}/oidc/jwks`));
|
|||||||
|
|
||||||
export type AppUser = IAppUser;
|
export type AppUser = IAppUser;
|
||||||
|
|
||||||
export async function authenticateRequest(req: any): Promise<IAppUser | null> {
|
export async function authenticateRequest(req: Request): Promise<IAppUser | null> {
|
||||||
const authHeader = req.headers.authorization;
|
const authHeader = req.headers.authorization;
|
||||||
|
|
||||||
if (!authHeader?.startsWith('Bearer ')) {
|
if (!authHeader?.startsWith('Bearer ')) {
|
||||||
@@ -96,7 +97,7 @@ export async function authenticateRequest(req: any): Promise<IAppUser | null> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function requireAuth() {
|
export function requireAuth() {
|
||||||
return async (req: any, res: any, next: any) => {
|
return async (req: Request, res: Response, next: NextFunction) => {
|
||||||
const user = await authenticateRequest(req);
|
const user = await authenticateRequest(req);
|
||||||
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
@@ -109,7 +110,7 @@ export function requireAuth() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function requireRole(roles: string[]) {
|
export function requireRole(roles: string[]) {
|
||||||
return async (req: any, res: any, next: any) => {
|
return async (req: Request, res: Response, next: NextFunction) => {
|
||||||
const user = await authenticateRequest(req);
|
const user = await authenticateRequest(req);
|
||||||
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
|
|||||||
Reference in New Issue
Block a user