FIEF NextJS

This commit is contained in:
Koper
2023-08-17 22:57:59 +07:00
parent 0e5bc7e997
commit 1b1e67901c
7 changed files with 122 additions and 6 deletions

20
www/middleware.ts Normal file
View File

@@ -0,0 +1,20 @@
import type { NextRequest } from "next/server";
import { fiefAuth } from "./app/lib/fief";
const authMiddleware = fiefAuth.middleware([
{
matcher: "/private",
parameters: {},
},
{
matcher: "/castles/:path*",
parameters: {
permissions: ["castles:read"],
},
},
]);
export async function middleware(request: NextRequest) {
return authMiddleware(request);
}