Files
ai4se-harness-suite/example-project/docs/facts/tech-topic/security.md
ning-inspire 670e0c1fa1 refactor: 默认 skills 装到 .agents,并清空 example 旧演示实现
对齐安装目录与 opencode 扫描路径;按 confirmed plan 清掉与 iteration1 不对齐的示例业务代码与 as-built 文档,只留空壳与需求输入。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-17 13:22:29 +08:00

31 lines
826 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.
# 安全设计
> 平台骨架 as-built。登录/注册等业务 API 待 ACC 实现。
## JWT Token
**算法**:HMAC-SHA256(`jjwt`)
**配置**:`jwt.secret` / `jwt.expiration`(毫秒)
**Claims(约定)**:`sub`=userId,`email`,`role`(如 `ROLE_USER` / `ROLE_ADMIN`),`iat`,`exp`
## 处理流程
```
请求 → JwtAuthenticationFilter
提取 Bearer token → 校验 → UserContextHolder + SecurityContextHolder
finally 清除 ThreadLocal / SecurityContext
```
## 当前放行
- `GET /api/v1/health` — permitAll
- 其它 `/api/**` — authenticated(无签发入口时仅能带有效 token 访问)
## 相关类
- `JwtTokenProvider` / `JwtAuthenticationFilter`
- `UserContext` / `UserContextHolder` / `SecurityUtils`
- `PasswordService` / `PasswordServiceImpl`(BCrypt)