nex_docus/docs/sdd/specs/DV-0001-auth/spec.md

33 lines
1.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# DV-0001认证与会话 规格Spec
- **状态**Implemented
- **关联 ADR**ADR-0003
## 目标
提供安全的用户认证与会话管理,为所有受保护资源提供身份基础。
## 范围
- **In**注册、登录、登出、修改密码、个人资料、头像上传、JWT Bearer + Redis 双校验。
- **Out**:第三方 SSO/OAuth 登录。
## 用户故事
> 作为用户,我希望登录一次后持续访问项目/文档,以便高效工作而不反复输入凭据。
## 功能需求FR
| ID | 需求描述 | 验收要点 |
| --- | --- | --- |
| FR-1 | 注册/登录/登出、改密、资料、头像 | 登录返回 JWT退出后 token 失效 |
| FR-1a | 每次请求经 get_current_user 校验 | Redis 缓存 + JWT 完整性 + 用户状态;禁用即拒绝 |
## 非功能需求NFR
| ID | 需求 |
| --- | --- |
| NFR-1 | 密码 bcrypt 哈希存储,绝不明文 |
| NFR-2 | JWT + Redis Token 缓存双校验token 存 Redis 可失效 |
| NFR-9 | 敏感日志脱敏(缺陷,见 OI-1 |
## 边界与约束
- 使用 OAuth2 password bearertoken 有效期 ACCESS_TOKEN_EXPIRE_MINUTES=1440。
- 用户被禁用status!=1即拒绝访问。