feat: integrate NextAuth for authentication, refactor login and registration processes, and enhance middleware for session management

This commit is contained in:
Julien Froidefond
2025-10-16 15:50:37 +02:00
parent 9ecdd72804
commit 7426bfb33c
33 changed files with 417 additions and 729 deletions

17
src/lib/auth-utils.ts Normal file
View File

@@ -0,0 +1,17 @@
import { auth } from "@/lib/auth";
import type { UserData } from "@/lib/services/auth-server.service";
export async function getCurrentUser(): Promise<UserData | null> {
const session = await auth();
if (!session?.user) {
return null;
}
return {
id: session.user.id,
email: session.user.email,
roles: session.user.roles,
authenticated: true,
};
}