Commit Graph

58 Commits

Author SHA1 Message Date
Ho Ngoc Hai
12cbcd5d8e fix(authentication): Update JWT handling for ASP.NET Core 8 compatibility
- Replaced JwtSecurityToken with JsonWebToken in DependencyInjection.cs to align with ASP.NET Core 8+ requirements.
- Enhanced CustomWebApplicationFactory to configure minimal JWT validation and custom authentication handling for functional tests.
- Removed outdated tests that relied on InMemory Database limitations, ensuring a cleaner test suite.
- Updated RegisterUserCommandHandlerTests to throw DuplicateResourceException for better error handling.
2026-01-12 20:49:53 +07:00
Ho Ngoc Hai
93165f4549 feat(authentication): Migrate from OpenIddict to Duende IdentityServer for OAuth2 support
- Replaced OpenIddict references with Duende IdentityServer in the project, including updates to the API project and infrastructure.
- Refactored authentication and authorization logic in AuthController, LogoutCommandHandler, and related services to align with Duende IdentityServer's structure.
- Updated dependency injection configuration to register Duende IdentityServer components and JWT Bearer authentication.
- Enhanced functional tests to accommodate changes in authentication flow and ensure compatibility with the new identity server.
- Removed obsolete OpenIddict components and related code to streamline the project.
2026-01-12 20:29:15 +07:00
Ho Ngoc Hai
eb5cb28d9f feat(exceptions): Introduce custom exceptions for better error handling and validation
- Added custom exceptions: DuplicateResourceException, EntityNotFoundException, AuthenticationFailedException, and BusinessRuleException to improve error handling in the application.
- Updated Program.cs to map these exceptions to appropriate HTTP status codes and problem details for better client feedback.
- Refactored RegisterUserCommandHandler to throw DuplicateResourceException when a user with the same email already exists.
- Enhanced testing setup in CustomWebApplicationFactory to ensure proper handling of these exceptions during functional tests.
2026-01-12 20:04:38 +07:00
Ho Ngoc Hai
74f423992b feat(dependency-injection): Refactor DbContext registration and enhance testing setup
- Updated DependencyInjection.cs to conditionally register DbContext based on the environment, skipping registration in the Testing environment.
- Improved CustomWebApplicationFactory to remove existing DbContext and Redis registrations, ensuring a clean setup for tests.
- Added methods to streamline the removal of DbContext and Redis service registrations.
- Updated functional tests to include better logging and error handling for unexpected responses.
- Bumped Microsoft.EntityFrameworkCore.InMemory package version to 10.0.1 for compatibility.
- Removed obsolete SamplesControllerTests file to clean up the test suite.
2026-01-12 19:18:19 +07:00
Ho Ngoc Hai
616bd9ede9 feat(api): Refactor Program.cs for improved service configuration and logging
- Reorganized the Program.cs file to streamline service configuration, including Serilog setup, API versioning, and health checks.
- Added logging configuration to set a minimum logging level for tests, reducing output noise.
- Enhanced Swagger integration with detailed API documentation and OAuth2 security definitions.
- Implemented ProblemDetails middleware for better error handling and added support for health check endpoints.
2026-01-12 19:12:07 +07:00
Ho Ngoc Hai
fdcc24bdf4 feat(infrastructure): Enhance dependency injection for Redis caching and add InMemory cache service for testing
- Updated AddInfrastructure method to accept an environment name parameter for conditional Redis caching configuration.
- Implemented logic to skip Redis caching setup in the Testing environment.
- Added InMemoryCacheService for testing purposes, providing a mock implementation of ICacheService.
- Enhanced TransactionBehavior to skip transactions for InMemory databases.
- Updated functional tests to remove Redis-related services and ensure proper database setup for testing.
2026-01-12 19:04:49 +07:00
Ho Ngoc Hai
ba928022cb feat(docs): Update architecture and caching documentation
- Added detailed sections on distributed caching architecture, including caching overview, ICacheService interface, and caching strategies for tokens and sessions.
- Enhanced documentation with mermaid diagrams to illustrate caching flows and key patterns.
- Updated Redis configuration instructions in the README, including environment variable setup and usage examples for caching operations.
- Removed outdated notes from the NOTE.MD file to streamline content and focus on relevant tasks and proposals.
2026-01-12 18:48:50 +07:00
Ho Ngoc Hai
bb4cf4884c feat(redis): Implement Redis caching and update configuration
- Added Redis caching support to the IAM service, including configuration settings in `appsettings.json` and environment variables.
- Introduced `ICacheService` interface for caching operations and implemented `RedisCacheService`.
- Updated documentation to include Redis setup instructions and usage examples for caching user data and token management.
- Enhanced user account management by adding an `Activate` method to the `ApplicationUser` class.
- Fixed assertions in unit tests to reflect the updated user status after activation.
2026-01-12 18:45:31 +07:00
Ho Ngoc Hai
079b24f683 feat(api): Enhance OAuth2 token endpoint and debugging capabilities
- Added debug middleware for /connect/* endpoints to log request and response details for better troubleshooting.
- Updated OAuth2 configuration to include "offline_access" scope and disabled access token encryption for development.
- Improved DbContext registration in tests by removing all related registrations and ensuring in-memory database setup for testing purposes.
- Addressed issues with the /connect/token endpoint not responding, outlining next steps for debugging and fixing the OpenIddict configuration.
2026-01-12 18:22:47 +07:00
Ho Ngoc Hai
435e5c2dfa feat(docs): Add database migration instructions and Neon setup details
- Introduced comprehensive sections on database migrations in the README files for English and Vietnamese documentation, including prerequisites, migration creation, and application steps.
- Added instructions for setting up the Neon database, including connection string configuration in `appsettings.Development.json`.
- Updated the `appsettings.Development.json` file with a default connection string for the Neon database and added Redis configuration.
- Included additional EF Core commands for managing migrations in the Vietnamese documentation.
2026-01-12 17:52:35 +07:00
Ho Ngoc Hai
4ae24a7bc8 feat(docs): Revamp IAM service documentation and authentication flow
- Updated README and architecture documentation to reflect the new authentication flow, including user registration, login, token management, and logout processes.
- Enhanced API documentation with detailed examples for each step of the authentication process, including curl commands and expected responses.
- Improved clarity in the architecture diagrams, outlining the interaction between clients, API, application, and infrastructure layers.
- Added sections on OAuth2 grant types and user management functionalities to provide comprehensive guidance for developers.
- Streamlined Vietnamese documentation to ensure consistency with English updates and improve accessibility for users.
2026-01-12 16:37:31 +07:00
Ho Ngoc Hai
c621afbb74 feat(api): Enhance authentication and user management endpoints
- Updated API documentation to include new user management features such as password change and logout functionalities.
- Added detailed descriptions and examples for OAuth2 token endpoint, supporting password, refresh token, and client credentials grants.
- Introduced new endpoints for user management, including retrieving, updating, and deleting users.
- Enhanced Swagger annotations for better clarity and usability of the API documentation.
- Implemented response models for password change and logout operations to standardize API responses.
2026-01-12 16:25:54 +07:00
Ho Ngoc Hai
07cb482edc fix(config): Update application URL in launchSettings.json for development environment
- Changed the application URL from http://localhost:5000 to http://localhost:5001 to align with updated service configurations.
- This adjustment ensures proper routing during local development.
2026-01-12 14:04:36 +07:00
Ho Ngoc Hai
b9065fe858 feat(docs): Enhance API documentation and Swagger integration
- Enabled XML documentation generation for improved API documentation.
- Updated API descriptions and added detailed endpoint information for better clarity.
- Introduced Swagger annotations for authentication and user management endpoints.
- Enhanced response types and added pagination information in user-related responses.
- Included contact and license information in the API metadata for better transparency.
2026-01-12 13:52:12 +07:00
Ho Ngoc Hai
07f96a8eb2 feat(docs): Enhance Vietnamese documentation with new sections and updates
- Added new sections on API Design, Caching Patterns, and Testing Patterns to the Vietnamese documentation.
- Updated sidebar configurations for improved navigation and accessibility.
- Removed outdated onboarding guides to streamline content and focus on relevant resources.
2026-01-12 13:36:53 +07:00
Ho Ngoc Hai
66d87ac865 feat(docs): Remove ARCHITECTURE.md and README.md for project simplification
- Deleted ARCHITECTURE.md and README.md files to streamline the project structure and eliminate outdated documentation.
- This change aims to enhance usability and focus on more relevant resources for users.
2026-01-12 12:22:54 +07:00
Ho Ngoc Hai
aa7a0d9ee2 feat(docs): Revise .env.example and architecture documentation for clarity and updates
- Simplified the .env.example file by removing outdated comments and consolidating environment variable descriptions.
- Updated the architecture documentation to reflect the new structure and components of the .NET 10 microservice template.
- Enhanced clarity in the README.md to provide a more comprehensive overview of the template's features and requirements.
- Removed obsolete appsettings files to streamline the project structure and improve usability.
2026-01-10 21:52:09 +07:00
Ho Ngoc Hai
2cfbd0706f feat(docs): Add Redis Cache integration details to Vietnamese documentation
- Updated README.md to include Redis Cache integration as a new feature.
- Enhanced DependencyInjection.cs to register Redis Cache services and connection settings.
- Improved clarity in Vietnamese documentation regarding Clean Architecture principles.
2026-01-10 21:24:18 +07:00
Ho Ngoc Hai
0b0241143a feat(docs): Enhance Vietnamese documentation with updated diagrams and troubleshooting sections
- Improved Mermaid diagrams for better visual clarity and consistency across guides.
- Added detailed troubleshooting sections to assist users in diagnosing common issues effectively.
- Updated formatting and structure to align with the English version, ensuring consistency.
- Included quick tips and common issues sections to facilitate user navigation.
2026-01-10 21:21:41 +07:00
Ho Ngoc Hai
4e595d0746 feat(docs): Remove outdated service templates and enhance Vietnamese architecture documentation
- Deleted obsolete service architecture templates in both English and Vietnamese to streamline content.
- Updated the Vietnamese architecture documentation with improved Mermaid diagrams for better visual clarity.
- Enhanced color coding in diagrams to improve readability and consistency across documentation.
- Added a new section detailing visual indicators for better understanding of architecture components.
2026-01-10 21:00:02 +07:00
Ho Ngoc Hai
808ab54d31 refactor: Cập nhật cấu hình PrismaClient trong môi trường kiểm thử để sử dụng biến môi trường DATABASE_URL. 2026-01-07 18:18:16 +07:00
Ho Ngoc Hai
2b64101adb refactor: Sắp xếp lại các import và đơn giản hóa khối catch trong health controller. 2026-01-07 18:17:14 +07:00
Ho Ngoc Hai
a7d2362b2f refactor: cập nhật cấu hình ESLint, TypeScript để bao gồm tệp kiểm thử và chuẩn hóa cách sắp xếp import, ghi log. 2026-01-07 18:15:00 +07:00
Ho Ngoc Hai
b5f97e2012 feat: Cấu hình ESLint flat config mới, thêm jsconfig.json, và sắp xếp lại các import tự động. 2026-01-07 17:48:49 +07:00
Ho Ngoc Hai
471508baa4 feat: Xóa ứng dụng web-admin và cập nhật các controller, DTO, cấu hình dịch vụ cùng các dependency của gói. 2026-01-07 17:28:23 +07:00
Ho Ngoc Hai
935c253c7e feat: upgrade Phase 1 dependencies to latest versions
- Upgrade TypeScript 5.3.3 → 5.9.3
- Upgrade @types/node to 25.0.3 (all workspaces)
- Upgrade Prisma 5.22.0 → 7.2.0 (BREAKING)
- Upgrade @prisma/client 5.9.1 → 7.2.0 (BREAKING)

BREAKING CHANGES:
- Prisma 7 requires prisma.config.ts instead of url in datasource
- Migrated to Neon adapter with @neondatabase/serverless
- Added @prisma/adapter-neon for Prisma 7 compatibility
- Removed url property from schema.prisma datasource blocks
- Created prisma.config.ts for iam-service and _template

All services tested and typecheck passes
2026-01-07 17:20:34 +07:00
Ho Ngoc Hai
200bf0b8fd chore: Cập nhật các phụ thuộc như TypeScript, Node.js types, Prisma và thông tin về thương hiệu, người duy trì trên toàn dự án. 2026-01-07 17:18:36 +07:00
Ho Ngoc Hai
63f5b10fe2 chore: upgrade to Node.js 25.2.1
- Update .nvmrc to Node 25
- Update all Dockerfiles to use node:25-alpine
- Update package.json engines to >=25.0.0
- Update CI/CD workflows for Node 25
- Update @types/node in packages
- Fix ESLint config to use ES module syntax
- Update OpenTelemetry imports for compatibility

All services tested and working with Node.js 25.2.1
2026-01-07 17:15:25 +07:00
Ho Ngoc Hai
c54a9debe3 feat: Vô hiệu hóa tạm thời Redis cache và sử dụng in-memory cache làm fallback. 2026-01-04 15:19:05 +07:00
Ho Ngoc Hai
101c333181 feat: Cải thiện cấu hình Redis client với tùy chọn kết nối ổn định hơn, chiến lược thử lại nâng cao và xử lý sự kiện kết nối tốt hơn. 2026-01-04 15:08:02 +07:00
Ho Ngoc Hai
d4f6115179 refactor: Cập nhật cấu hình các tuyến đường (routes) của dịch vụ IAM và API xác thực phía client, đồng thời loại bỏ tệp sao lưu RBAC cũ. 2026-01-04 14:35:12 +07:00
Ho Ngoc Hai
a383d8772e feat: Cấu hình lại ứng dụng IAM, cập nhật cấu trúc routes, tích hợp RBAC và thêm các bài kiểm tra tích hợp. 2026-01-04 14:27:41 +07:00
Ho Ngoc Hai
ccfb2a7fb2 feat: Thêm định nghĩa schema cho yêu cầu truy cập, đánh giá truy cập, chính sách, báo cáo tuân thủ và phiên vào tài liệu Swagger. 2026-01-04 13:56:12 +07:00
Ho Ngoc Hai
7e7a7a5853 refactor: Modularize IAM service routes into dedicated modules and add home page description 2026-01-04 13:53:34 +07:00
Ho Ngoc Hai
76b1c9b3a0 refactor: chuẩn hóa xử lý lỗi bằng cách giới thiệu tiện ích getErrorMessage và cập nhật kiểu catch thành unknown. 2026-01-04 13:31:11 +07:00
Ho Ngoc Hai
19e5e9b242 refactor: Cập nhật các import thư viện sang named imports cho express-rate-limit, jsonwebtokendompurify. 2026-01-04 13:17:28 +07:00
Ho Ngoc Hai
202b99873a feat: Thêm cấu hình môi trường cục bộ và hoàn thành các tác vụ tăng cường bảo mật cho IAM service, bao gồm tạo dịch vụ mã hóa. 2026-01-04 12:09:46 +07:00
Ho Ngoc Hai
f315a7af51 refactor: Replaced dynamic rate limit creation with pre-configured role-based limiters. 2026-01-04 12:00:23 +07:00
Ho Ngoc Hai
fc33f027d6 build: Thêm binary targets cho Prisma, chuyển rate limiter sang memory store, và cập nhật Dockerfile để sử dụng pnpm hoisting cùng openssl runtime. 2026-01-04 11:53:33 +07:00
Ho Ngoc Hai
fcbe176b3e feat: Tối ưu Dockerfile của iam-service bằng cách lọc cài đặt pnpm, tinh chỉnh loại bỏ dev dependencies và thiết lập workspace đúng cách. 2026-01-04 11:24:43 +07:00
Ho Ngoc Hai
c05ce82c7b feat: Thêm bước generate Prisma Client rõ ràng vào Dockerfile của iam-service. 2026-01-04 10:52:13 +07:00
Ho Ngoc Hai
7154c37a31 feat: Cải thiện dịch vụ mã hóa AES-256-GCM và tích hợp khóa mã hóa vào cấu hình môi trường để bảo vệ dữ liệu nhạy cảm. 2026-01-04 10:48:08 +07:00
Ho Ngoc Hai
9aed3da8eb refactor: Đổi tên các model Prisma userPermissions, userRoles, riskAssessment và bỏ backupCode trong IAM service. 2026-01-04 10:02:54 +07:00
Ho Ngoc Hai
0d48dedc08 feat: Khởi tạo Prisma client, bổ sung các bài kiểm tra đơn vị và tích hợp, đồng thời điều chỉnh cấu hình dịch vụ. 2026-01-04 09:34:37 +07:00
Ho Ngoc Hai
1a2103f86e Update IAM Service E2E tests and audit plan
- Marked E2E test tasks as completed in the IAM Service audit plan for better tracking.
- Enhanced E2E tests by mocking the Prisma client and its methods to simulate database interactions.
- Improved test coverage for feature creation, update, and deletion operations in the E2E tests.

These changes aim to streamline testing processes and ensure accurate simulation of service behavior.
2026-01-02 16:14:41 +07:00
Ho Ngoc Hai
8cc2f66df6 Update IAM Service with various enhancements and fixes
- Added `xmlchars` dependency to `pnpm-lock.yaml` for improved XML character handling.
- Updated IAM Service audit plan to streamline post-deployment monitoring tasks.
- Enhanced Dockerfile to prune development dependencies after build for a leaner production image.
- Introduced a new encryption key configuration in the environment example for better security practices.
- Refactored multiple service files to improve import organization and maintainability.
- Improved error handling in seed scripts to provide more detailed logging on failures.
- Updated various controllers and services to ensure consistent import statements and enhance readability.

These changes aim to improve the overall functionality, security, and maintainability of the IAM Service.
2026-01-02 16:13:36 +07:00
Ho Ngoc Hai
5ce05c63e7 Enhance web-admin application with internationalization and UI improvements
- Integrated `@hookform/resolvers` and `@radix-ui/react-avatar` for improved form handling and avatar components.
- Updated Tailwind CSS configuration and global styles for better responsiveness and accessibility.
- Refactored layout components to include `I18nProvider` for dynamic language support.
- Enhanced various UI elements with translated strings for better user experience.
- Improved error handling and validation messages in forms to support localization.

These changes aim to provide a more inclusive and user-friendly experience in the web-admin application.
2026-01-02 10:36:38 +07:00
Ho Ngoc Hai
c088de53c3 Update dependencies and enhance Tailwind CSS configuration for web applications
- Added new dependencies including clsx, lucide-react, recharts, and various Radix UI components to improve UI functionality.
- Upgraded Tailwind CSS to version 4.0.0 and updated configuration to utilize CSS variables for theming and responsive design.
- Introduced global styles and improved accessibility features in the layout and components.
- Removed outdated login page and refactored authentication store for better state management.
- Enhanced API service with additional authentication methods and improved error handling.

These changes aim to modernize the web applications and improve user experience through better design and functionality.
2026-01-02 09:41:40 +07:00
Ho Ngoc Hai
af303eaf7b Enhance IAM Service documentation with comprehensive updates
- Expanded the IAM Service README to include a detailed overview, features showcase, and quick start guide.
- Updated API reference with new endpoints for health checks and identity management.
- Improved implementation details, including completed features and module dependencies.
- Enhanced architecture documentation with clear diagrams and structured sections for better understanding.
- Added quick reference tables for API endpoints across various modules, improving accessibility for developers.

These changes aim to provide a clearer, more comprehensive understanding of the IAM Service's capabilities and usage.
2026-01-02 00:39:14 +07:00
Ho Ngoc Hai
d8411abd24 Revise IAM Service Architecture documentation for clarity and comprehensiveness
- Updated the document title to reflect the focus on IAM Service Architecture.
- Expanded the overview section to provide a clearer description of the IAM Service's capabilities.
- Enhanced the table of contents for better navigation.
- Added detailed architecture diagrams illustrating the layered architecture and key components.
- Included comprehensive sections on authentication flows, authorization models, caching strategies, and security architecture.
- Improved overall structure and readability to facilitate understanding of the IAM Service's design and functionality.

These changes aim to provide developers with a thorough understanding of the IAM Service architecture and its components.
2026-01-02 00:30:26 +07:00