feat(auth): enterprise authentication and user management
This commit is contained in:
parent
4bc8b20a21
commit
86a32a942c
36 changed files with 2239 additions and 324 deletions
24
frontend/athena/proxy.ts
Normal file
24
frontend/athena/proxy.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import { NextRequest, NextResponse } from "next/server";
|
||||
|
||||
export function proxy(request: NextRequest) {
|
||||
const token = request.cookies.get("access_token");
|
||||
const isLoginPage = request.nextUrl.pathname === "/login";
|
||||
|
||||
if (isLoginPage && token) {
|
||||
return NextResponse.redirect(new URL("/dashboard", request.url));
|
||||
}
|
||||
|
||||
if (!isLoginPage && !token) {
|
||||
return NextResponse.redirect(new URL("/login", request.url));
|
||||
}
|
||||
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
export const config = {
|
||||
matcher: [
|
||||
"/login",
|
||||
"/dashboard/:path*",
|
||||
"/users/:path*",
|
||||
],
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue