16 lines
592 B
TypeScript
16 lines
592 B
TypeScript
// src/middleware.ts — V2 单 cookie 模型,Edge 验签 + iss 校验
|
||
import { createMiddlewareV2 } from '@shared/lib/auth/middleware-v2'
|
||
|
||
const jwtSecret = process.env.JWT_SECRET || 'oa-shared-jwt-secret-tlyq-2026'
|
||
const cookieDomain = process.env.COOKIE_DOMAIN || '.tlyq.ai'
|
||
|
||
export const middleware = createMiddlewareV2({
|
||
jwtSecret,
|
||
cookieDomain,
|
||
allowedIssuers: ['*'],
|
||
enableApiKey: false,
|
||
publicPaths: ['/login', '/api/auth', '/api/health', '/api/internal', '/_next', '/favicon.ico'],
|
||
})
|
||
|
||
export const config = { matcher: ['/((?!_next/static|_next/image|favicon.ico).*)'] }
|