WIP 5
This commit is contained in:
parent
b8c6e893ff
commit
b09cc82544
167 changed files with 2196 additions and 1302 deletions
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
import { withAuth } from "next-auth/middleware";
|
||||
|
||||
export default withAuth(
|
||||
|
|
@ -6,26 +7,13 @@ export default withAuth(
|
|||
signIn: `/login`,
|
||||
},
|
||||
callbacks: {
|
||||
authorized: ({ token, req }) => {
|
||||
const {
|
||||
url,
|
||||
} = req;
|
||||
const parsedURL = new URL(url);
|
||||
|
||||
console.log({ url });
|
||||
console.log({ pathname: parsedURL.pathname });
|
||||
console.log({ allowed: parsedURL.pathname.startsWith("/app") });
|
||||
const allowed = parsedURL.pathname.startsWith('/login') || parsedURL.pathname.startsWith('/api' || parsedURL.pathname.startsWith("/app"));
|
||||
if (allowed) {
|
||||
return true;
|
||||
}
|
||||
|
||||
authorized: ({ token }) => {
|
||||
// check for existence in opensearch user list
|
||||
if (token?.email) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
@ -33,6 +21,6 @@ export default withAuth(
|
|||
|
||||
export const config = {
|
||||
matcher: [
|
||||
'/((?!api|app|bootstrap|3961|ui|translations|internal|login|node_modules|_next/static|_next/image|favicon.ico).*)',
|
||||
'/((?!api|app|login|_next/static|_next/image|favicon.ico).*)',
|
||||
],
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue