Files
Edu/services/iam/README.md
SpecialX 524204d30a feat(p2): identity layer with IAM service and Teacher BFF
P2 阶段交付物:
- services/iam: 完整身份认证服务(users/roles/permissions/refresh_tokens 6 表 schema)
  - register/login/refresh/getUserInfo 4 个核心 API
  - bcrypt 密码哈希 + JWT 双 Token(access + refresh)
  - 复用 classes 黄金模板(errors/observability/middleware 三件套)
- services/teacher-bff: 教师聚合 BFF
  - Promise.allSettled 并行聚合 IAM + classes 数据
  - /teacher/dashboard 单一聚合端点
- packages/shared-proto/proto/iam.proto: IamService 契约(Register/Login/RefreshToken/GetUserInfo)
- api-gateway: 新增 IamServiceURL/TeacherBffURL 配置 + /iam/* + /teacher/* 路由
2026-07-08 01:37:29 +08:00

36 lines
939 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# IAM Service
身份与访问管理服务Identity and Access ManagementP2 身份阶段交付。
## 职责
- 用户注册 / 登录 / 刷新令牌
- 角色Role与权限Permission管理
- Access / Refresh Token 签发与校验
- 用户信息查询(供 BFF / Gateway 聚合)
## 技术栈
- NestJS 10 + TypeScriptESM
- Drizzle ORM + MySQL
- bcrypt 密码哈希
- jsonwebtokenP2 骨架使用 HS256后续切 RS256
- pino 日志 / prom-client 指标 / OpenTelemetry 链路
## 端口
默认 `3002`,通过 `PORT` 环境变量覆盖。
## API
| Method | Path | 说明 |
|--------|------|------|
| POST | `/iam/register` | 注册 |
| POST | `/iam/login` | 登录 |
| POST | `/iam/refresh` | 刷新令牌 |
| GET | `/iam/me` | 当前用户信息(需 `x-user-id` 头) |
## 数据表
`iam_users` / `iam_roles` / `iam_user_roles` / `iam_permissions` / `iam_role_permissions` / `iam_refresh_tokens`