init
This commit is contained in:
@@ -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|.*\\.).*)"],
|
||||
};
|
||||
Reference in New Issue
Block a user