feat(system): 按 OAuth2 客户端 platform 过滤菜单,支持业务/物联双前端
问题:业务平台(biz)和物联运维平台(iot)共用一套用户体系和菜单表,但每个前端 只该看到自己域的菜单。原来没有按客户端过滤的机制。 方案:在 OAuth2 客户端维度打 platform 标签(biz/iot/NULL),菜单也打同样标签, 登录时下发菜单按二者匹配过滤。 链路: - OAuth2AccessTokenCheckRespDTO / LoginUser(framework + gateway)新增 clientId 字段 - TokenAuthenticationFilter(framework + gateway)把 accessToken.clientId 带进 LoginUser - WebFrameworkUtils.HEADER_CLIENT_ID="X-Client-Id":登录/refresh 等"无 token 入口" 允许前端声明 client,避免硬编码 default - AdminAuthServiceImpl.resolveClientId:未传 Header 时回退 OAuth2ClientConstants.CLIENT_ID_DEFAULT - MenuDO / OAuth2ClientDO 各加 platform 列 - MenuService.filterMenusByPlatform:platform 为空(全平台共用)或匹配即保留 SQL 迁移按字母序编号: - _01_oauth2_client_platform.sql:加列 + 给 default/iot-client 客户端打标 + 递归标 IoT 菜单子树(root id=4000)为 iot - _02_bulk_mark_biz_menus.sql:其余 platform=NULL 的菜单兜底标 biz - 顺序依赖:_01 标完 iot 后 _02 才动剩余 NULL,避免 _02 把 IoT 菜单错标 biz Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -18,6 +18,9 @@ public class OAuth2AccessTokenCheckRespDTO implements Serializable {
|
||||
@Schema(description = "用户类型,参见 UserTypeEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer userType;
|
||||
|
||||
@Schema(description = "OAuth2 客户端编号,用于按客户端区分前端来源(如 default、iot-client)", example = "iot-client")
|
||||
private String clientId;
|
||||
|
||||
@Schema(description = "用户信息", example = "{\"nickname\": \"芋道\"}")
|
||||
private Map<String, String> userInfo;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user