This commit is contained in:
Tom Chien (IQ-AS)
2026-09-08 17:46:28 +08:00
commit e25c995560
55 changed files with 6928 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
import NextAuth from "next-auth";
import { authConfig } from "@/auth.config";
// Protect the whole app with role-aware auth. Runs in the edge runtime, so it
// uses the edge-safe authConfig (no node:fs / providers). The `authorized`
// callback there redirects unauthenticated users to /login and blocks normal
// users from admin pages / write APIs.
export const { auth: middleware } = NextAuth(authConfig);
export const config = {
// Run on everything EXCEPT: the auth endpoints (must stay public so users can
// sign in), Next.js internals, and static asset requests (files with a dot).
matcher: ["/((?!api/auth|_next/static|_next/image|favicon.ico|.*\\.).*)"],
};