feat: implement AuthModule with authentication and RBAC features

Added AuthModule with services, controllers, and guards for authentication. Implements session management, role-based access control, 2FA, and DTOs for user login, registration, and token refresh.
This commit is contained in:
Mathis HERRIOT
2026-01-08 15:24:40 +01:00
parent 9406ed9350
commit 42805e371e
12 changed files with 509 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
import { IsEmail, IsNotEmpty, IsString } from "class-validator";
export class LoginDto {
@IsEmail()
email!: string;
@IsString()
@IsNotEmpty()
password!: string;
}

View File

@@ -0,0 +1,7 @@
import { IsNotEmpty, IsString } from "class-validator";
export class RefreshDto {
@IsString()
@IsNotEmpty()
refresh_token!: string;
}

View File

@@ -0,0 +1,14 @@
import { IsEmail, IsNotEmpty, IsString, MinLength } from "class-validator";
export class RegisterDto {
@IsString()
@IsNotEmpty()
username!: string;
@IsEmail()
email!: string;
@IsString()
@MinLength(8)
password!: string;
}

View File

@@ -0,0 +1,10 @@
import { IsNotEmpty, IsString, IsUUID } from "class-validator";
export class Verify2faDto {
@IsUUID()
userId!: string;
@IsString()
@IsNotEmpty()
token!: string;
}