changed session limit and scope of protection

This commit is contained in:
2024-02-29 14:19:35 +00:00
parent cb7647f237
commit 60b610054b
3 changed files with 41 additions and 14 deletions
+37
View File
@@ -0,0 +1,37 @@
// export { default } from "next-auth/middleware";
// export const config = {
// matcher: ["/myportal/", "/myportal/:path*"],
// };
// import { withAuth } from 'next-auth/middleware';
// export default withAuth({
// pages: {
// signIn: '/login',
// },
// });
import { withAuth } from "next-auth/middleware";
export default withAuth({
callbacks: {
authorized: ({ req }) => {
// verify token and return a boolean
const sessionToken = req.cookies.get("next-auth.session-token");
if (sessionToken) return true;
else return false;
},
},
});
export const config = {
matcher: [
"/myportal",
"/myportal/:path*",
"/newappeal",
"/newappeal/:path*",
"/account",
"/account/:path*",
],
};