update
This commit is contained in:
+14
-10
@@ -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 ---
|
||||
|
||||
Reference in New Issue
Block a user