docs: Update IAM Service documentation to include new Organization, Group, User Profile, and Identity Verification APIs

- Added new sections for Organization & Group APIs, User Profile APIs, and Identity Verification APIs in both English and Vietnamese documentation, reflecting the features introduced in Phase 2.
- Revised the implementation roadmap to indicate the completion of Identity Management features, enhancing clarity on the current capabilities of the IAM Service.
- Updated the Dependency Injection and DbContext to include new repositories and database tables for the added functionalities.
This commit is contained in:
Ho Ngoc Hai
2026-01-14 15:19:06 +07:00
parent 74860caf75
commit dfaf6b059b
69 changed files with 6434 additions and 40 deletions

View File

@@ -230,7 +230,41 @@ graph TD
| `PUT` | `/api/v1/roles/{id}` | Cập nhật role | ✅ Admin |
| `DELETE` | `/api/v1/roles/{id}` | Xóa role | ✅ Admin |
### 4.2 Access Management APIs
### 4.4 Organization & Group APIs ✅ (New in Phase 2)
| Method | Endpoint | Mô tả | Auth |
|--------|----------|-------|------|
| `GET` | `/api/v1/organizations/{id}` | Lấy tổ chức theo ID | ✅ |
| `GET` | `/api/v1/organizations/slug/{slug}` | Lấy tổ chức theo slug | ✅ |
| `POST` | `/api/v1/organizations` | Tạo tổ chức mới | ✅ |
| `PUT` | `/api/v1/organizations/{id}` | Cập nhật tổ chức | ✅ |
| `DELETE` | `/api/v1/organizations/{id}` | Lưu trữ (archive) tổ chức | ✅ |
| `GET` | `/api/v1/organizations/{id}/hierarchy` | Lấy phân cấp tổ chức | ✅ |
| `GET` | `/api/v1/organizations/{id}/children` | Lấy tổ chức con | ✅ |
| `GET` | `/api/v1/groups` | Danh sách groups theo organizationId | ✅ |
| `GET` | `/api/v1/groups/{id}` | Lấy group theo ID | ✅ |
| `POST` | `/api/v1/groups` | Tạo group mới | ✅ |
| `DELETE` | `/api/v1/groups/{id}` | Xóa group (soft delete) | ✅ |
| `POST` | `/api/v1/groups/{id}/members` | Thêm thành viên vào group | ✅ |
| `DELETE` | `/api/v1/groups/{id}/members/{userId}` | Xóa thành viên khỏi group | ✅ |
### 4.5 User Profile APIs ✅ (New in Phase 2)
| Method | Endpoint | Mô tả | Auth |
|--------|----------|-------|------|
| `GET` | `/api/v1/users/{id}/profile` | Lấy profile user | ✅ |
| `PUT` | `/api/v1/users/{id}/profile` | Cập nhật profile user | ✅ |
| `PUT` | `/api/v1/users/{id}/profile/attributes/{key}` | Đặt profile attribute | ✅ |
### 4.6 Identity Verification APIs ✅ (New in Phase 2)
| Method | Endpoint | Mô tả | Auth |
|--------|----------|-------|------|
| `POST` | `/api/v1/verifications/phone` | Yêu cầu xác thực số điện thoại | ✅ |
| `POST` | `/api/v1/verifications/email` | Yêu cầu xác thực email | ✅ |
| `POST` | `/api/v1/verifications/{id}/confirm` | Xác nhận với OTP code | ✅ |
### 4.7 Access Management APIs (Planned)
```
# Access Requests
@@ -281,17 +315,26 @@ GET /api/v1/governance/reports/security-events
## 5. Implementation Roadmap
### Phase 1: Foundation (Weeks 1-4)
- ✅ Migrate từ auth-service sang iam-service
- 🔄 Tổ chức lại modules theo IAM structure
- 🔄 Mở rộng database schema với identity models
- 🔄 Implement User Profile module
### Phase 1: Foundation ✅ (Completed)
- ✅ Migrate từ auth-service sang iam-service (.NET 10 + Duende IdentityServer)
- ✅ CQRS với MediatR Pattern
- ✅ User Registration, Login, Logout
- ✅ Password Management (change-password)
- ✅ User Management APIs (CRUD)
- ✅ Role Management APIs
### Phase 2: Identity Management (Weeks 5-8)
- 🔄 User lifecycle management
- 🔄 Identity verification (email, phone, document)
- 🔄 Organization & Group management
- 🔄 Profile management with extended attributes
### Phase 1.5: Enhanced Security ✅ (Completed)
- ✅ Email Verification (send + confirm)
- ✅ 2FA/MFA với TOTP (QR Code, Recovery Codes)
- ✅ Social Login (Google, Facebook OAuth)
- ✅ Distributed Caching với Redis (ICacheService)
- ✅ Token Blacklisting cho logout
### Phase 2: Identity Management ✅ (Completed)
- ✅ User lifecycle management
- ✅ Identity verification (phone, email)
- ✅ Organization & Group management
- ✅ Profile management with extended attributes (ProfileAttribute entity)
### Phase 3: Access Management (Weeks 9-12)
- 🔄 Access request/approval workflows

View File

@@ -256,7 +256,41 @@ graph TD
| `PUT` | `/api/v1/roles/{id}` | Cập nhật role | ✅ Admin |
| `DELETE` | `/api/v1/roles/{id}` | Xóa role | ✅ Admin |
### 4.7 Access Management APIs (Planned)
### 4.7 Organization & Group APIs ✅ (New in Phase 2)
| Method | Endpoint | Mô tả | Auth |
|--------|----------|-------|------|
| `GET` | `/api/v1/organizations/{id}` | Lấy tổ chức theo ID | ✅ |
| `GET` | `/api/v1/organizations/slug/{slug}` | Lấy tổ chức theo slug | ✅ |
| `POST` | `/api/v1/organizations` | Tạo tổ chức mới | ✅ |
| `PUT` | `/api/v1/organizations/{id}` | Cập nhật tổ chức | ✅ |
| `DELETE` | `/api/v1/organizations/{id}` | Lưu trữ (archive) tổ chức | ✅ |
| `GET` | `/api/v1/organizations/{id}/hierarchy` | Lấy phân cấp tổ chức | ✅ |
| `GET` | `/api/v1/organizations/{id}/children` | Lấy tổ chức con | ✅ |
| `GET` | `/api/v1/groups` | Danh sách groups theo organizationId | ✅ |
| `GET` | `/api/v1/groups/{id}` | Lấy group theo ID | ✅ |
| `POST` | `/api/v1/groups` | Tạo group mới | ✅ |
| `DELETE` | `/api/v1/groups/{id}` | Xóa group (soft delete) | ✅ |
| `POST` | `/api/v1/groups/{id}/members` | Thêm thành viên vào group | ✅ |
| `DELETE` | `/api/v1/groups/{id}/members/{userId}` | Xóa thành viên khỏi group | ✅ |
### 4.8 User Profile APIs ✅ (New in Phase 2)
| Method | Endpoint | Mô tả | Auth |
|--------|----------|-------|------|
| `GET` | `/api/v1/users/{id}/profile` | Lấy profile user | ✅ |
| `PUT` | `/api/v1/users/{id}/profile` | Cập nhật profile user | ✅ |
| `PUT` | `/api/v1/users/{id}/profile/attributes/{key}` | Đặt profile attribute | ✅ |
### 4.9 Identity Verification APIs ✅ (New in Phase 2)
| Method | Endpoint | Mô tả | Auth |
|--------|----------|-------|------|
| `POST` | `/api/v1/verifications/phone` | Yêu cầu xác thực số điện thoại | ✅ |
| `POST` | `/api/v1/verifications/email` | Yêu cầu xác thực email | ✅ |
| `POST` | `/api/v1/verifications/{id}/confirm` | Xác nhận với OTP code | ✅ |
### 4.10 Access Management APIs (Planned)
> [!NOTE]
> Các APIs dưới đây là tính năng **đang được lên kế hoạch**, chưa triển khai.
@@ -328,11 +362,11 @@ GET /api/v1/governance/reports/security-events
- ✅ Distributed Caching với Redis (ICacheService)
- ✅ Token Blacklisting cho logout
### Phase 2: Identity Management (Planned)
- 🔄 User lifecycle management
- 🔄 Identity verification (phone, document - KYC)
- 🔄 Organization & Group management
- 🔄 Profile management with extended attributes
### Phase 2: Identity Management ✅ (Completed)
- User lifecycle management
- Identity verification (phone, email)
- Organization & Group management
- Profile management with extended attributes (ProfileAttribute entity)
### Phase 3: Access Management (Planned)
- 🔄 Access request/approval workflows
@@ -376,30 +410,12 @@ GET /api/v1/governance/reports/security-events
- ✅ Better user experience
- ✅ Enhanced security với MFA & verification
---
## 7. Migration Strategy
### Từ Auth Service → IAM Service
1. **Rename Service**: `services/auth-service``services/iam-service`
2. **Update Package Name**: `@goodgo/auth-service``@goodgo/iam-service`
3. **Update Routes**:
- Giữ backward compatibility với `/api/v1/auth/*`
- Thêm routes mới cho `/api/v1/identity/*`, `/api/v1/access/*`, `/api/v1/governance/*`
4. **Database Migration**:
- Thêm schema mới cho identity, access, governance
- Giữ nguyên các tables hiện có (backward compatible)
5. **Gradual Rollout**:
- Phase 1: Deploy cùng auth-service (dual deployment)
- Phase 2: Migrate clients dần dần
- Phase 3: Deprecate auth-service khi migration hoàn tất
---
## Kết Luận
Đề xuất này mở rộng `auth-service` thành `IAM Service` với đầy đủ các tính năng:
Đề xuất này mở rộng thành `IAM Service` với đầy đủ các tính năng:
- **Identity Management** đầy đủ
- **Access Management** nâng cao
- **Governance & Compliance** toàn diện