Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🔐 Develop Authentication and Authorization System with RBAC
Module: Auth / Security
Type: Feature
📖 Overview
This PR implements a comprehensive authentication and authorization system with Role-Based Access Control (RBAC), JWT-based sessions, refresh token rotation, and fine-grained permission management.
The system is designed to be secure, scalable, and enterprise-ready, supporting advanced features such as account lockout, email verification, password recovery, two-factor authentication (2FA), hierarchical permissions, and performance-optimized permission checks.
🎯 Goals
👤 Core Entities
User
Role
Permission
assets,users,departments, etc.)CREATE,READ,UPDATE,DELETE,MANAGERefreshToken
🔗 RBAC & Permission Model
🔑 Authentication Flow
🔐 Advanced Security Features
🌐 API Endpoints
Authentication
POST /api/v1/auth/registerPOST /api/v1/auth/loginPOST /api/v1/auth/logoutPOST /api/v1/auth/refreshPOST /api/v1/auth/forgot-passwordPOST /api/v1/auth/reset-passwordPOST /api/v1/auth/verify-emailPOST /api/v1/auth/resend-verificationPOST /api/v1/auth/change-passwordPOST /api/v1/auth/2fa/enablePOST /api/v1/auth/2fa/verifyPOST /api/v1/auth/2fa/disableUsers
GET /api/v1/usersGET /api/v1/users/:idPOST /api/v1/usersPUT /api/v1/users/:idDELETE /api/v1/users/:idPATCH /api/v1/users/:id/activateGET /api/v1/users/meRoles & Permissions
GET /api/v1/rolesPOST /api/v1/rolesPUT /api/v1/roles/:idDELETE /api/v1/roles/:idGET /api/v1/permissionsPOST /api/v1/roles/:id/permissions🛠️ Technical Implementation
@RequirePermissiondecorator🧪 Validation & Rules
👥 Predefined Roles
✅ Acceptance Criteria
403🚀 Impact
This PR establishes a robust, enterprise-grade authentication and authorization foundation that supports current application needs while remaining flexible enough for future growth, compliance requirements, and security enhancements.
close #384