3 Commits

Author SHA1 Message Date
2f1f00a74a F2-6: JWT 瘦身——roles 不入 claims,RoleResolver 服务端缓存解析
- JwtService.issue() 移除 CLAIM_ROLES,token 仅携带 userId/account/name/depart/org
- JwtService.parse() roles 固定返回空列表(由 RoleResolver 填充)
- 新增 RoleResolver:Caffeine 缓存 userId→roles,TTL 5 分钟,容量 5000
  SQL 与 SysUserService 同源(sys_usergrouprole⋈sys_usergroupuser)
  DB 不可达时降级为空列表,不阻断请求
- JwtAuthFilter:parse 后调 RoleResolver 填充 roles,AuthPrincipal 对下游零改动
- SecurityConfig:注入 RoleResolver 传给 JwtAuthFilter
- platform-auth/pom.xml 加 Caffeine 依赖
- 单测覆盖:RoleResolverTest(命中/evict/evictAll/TTL降级)、JwtServiceTest 更新
  (roles不入token断言 + token<1KB断言)、EngineContextIsolationTest/SecurityProfileTest 适配

实测:admin token 316B,ceshi token 344B(原6413/16924字符)
2026-06-12 03:09:22 +08:00
33d793b825 feat(auth): P2-2 Spring Security 无状态 JWT 认证链路 + UserSession 引擎上下文适配
- jjwt 0.12.6 HS256;密钥配置化(EIP4_AUTH_JWT_SECRET),启动期强度校验,不入仓库
- 密码兼容:复刻 framework EncryptUtil 无盐 MD5 + 常量时间比对(侦察证据见报告)
- JwtAuthFilter:SecurityContext + 引擎 UserSession(静态 ThreadLocal)请求级 set/finally clear,16线程×200次并发隔离单测
- SecurityConfig 双链:prod 严格 401 / 非 prod 保留对拍测试通道(单测断言生产关闭)
- EntityController.buildCtx 三级优先(asUser > JWT > ADMIN),修复 JWT ctx 被 ADMIN 默认覆盖
- 实测:登录签发/过滤 16 行与 DB 吻合/伪造过期全 401;ci.sh 全绿;手册新增 §5.29-5.31

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 13:37:34 +08:00
a9219c5c77 chore: 落地 eip4-platform 多模块骨架基线(PoC→工程化)
从 eip4-poc 迁入双层制模块化单体:保真层 platform-legacy-core
(com.dsasp 引擎原样)+ 现代层 platform-metadata/auth/flow-gateway/
converter/ai + platform-app 启动器。ArchUnit 纪律固化(保真层禁依赖现代层)。
此为 C1 对拍工作的编译通过基线。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-10 23:40:51 +08:00