This commit is contained in:
s871077
2026-09-11 10:11:09 +08:00
parent e25c995560
commit 58587d19a8
25 changed files with 1643 additions and 54 deletions
+14 -10
View File
@@ -1,14 +1,18 @@
import NextAuth from "next-auth";
import { authConfig } from "@/auth.config";
// --- SSO DISABLED FOR CICD TEST ---
// Original: protect the whole app with role-aware auth in the edge runtime.
// import NextAuth from "next-auth";
// import { authConfig } from "@/auth.config";
//
// export const { auth: middleware } = NextAuth(authConfig);
// 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);
// No-op replacement. The EMPTY MATCHER below is the actual kill switch — this
// function is never invoked, and every route (including the three admin pages)
// is open.
export function middleware() {}
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|.*\\.).*)"],
// Original matcher (restore with the lines above):
// matcher: ["/((?!api/auth|_next/static|_next/image|favicon.ico|.*\\.).*)"],
matcher: [],
};
// --- END SSO DISABLED ---