# 大屏 — 免密登录 — 测试用例 > **接口 Base Path**:`/bigScreen`(含 `context-path`、网关前缀须补齐)。登录相关接口 **免鉴权**;登录成功后看板接口鉴权同若依 `Authorization` Token。 --- ## 1. 测试范围 | 类型 | 覆盖 | | --- | --- | | 单元测试 | RSA 加解密往返、UUID 格式校验、Service 启用/公钥、Controller 路由 | | 接口测试 | 公钥获取、Header/Body 登录、未启用、错误密文 | | UI 测试 | `ruoyi-screen` 自动登录(待前端对接) | **代码引用**:`ScreenLoginRsaSupportTest`、`ScreenLoginServiceTest`、`ScreenLoginControllerApiTest`。 --- ## 2. 单元测试 | 编号 | 模块 | 场景 | 工具 | 前置 | 步骤 | 预期 | | --- | --- | --- | --- | --- | --- | --- | | DP-ML-UT-001 | RSA | 加解密往返 | JUnit5 | 配置密钥对 | `encrypt(uuid)` → `decrypt` | 明文等于原 UUID | | DP-ML-UT-002 | RSA | UUID 合法 | JUnit5 | — | `isValidUuid(标准 UUID)` | true | | DP-ML-UT-003 | RSA | UUID 非法 | JUnit5 | — | `isValidUuid("hello")` / null | false | | DP-ML-UT-004 | RSA | 解密非 UUID 明文 | JUnit5 | 加密 `"hello"` | 解密后 `isValidUuid` | false | | DP-ML-UT-005 | Service | 未启用 | JUnit5 | `enabled=false` | `login(any)` | `ServiceException` | | DP-ML-UT-006 | Service | 获取公钥 | JUnit5 | `enabled=true` 且密钥已配 | `getRsaPublicKey()` | 返回配置公钥 | --- ## 3. 接口测试 | 编号 | 场景 | 工具 | 前置 | 请求 | 预期 | | --- | --- | --- | --- | --- | --- | | DP-ML-API-001 | 获取公钥 | Postman/curl | `enabled=true` | `GET /bigScreen/publicKey` | `code=200`;`data.publicKey` 非空 | | DP-ML-API-002 | 未启用 | Postman | `enabled=false` | `GET /bigScreen/publicKey` | 失败;提示未启用 | | DP-ML-API-003 | Header 登录 | Postman | 已启用;有效密文 | `POST /bigScreen/login`,头 `X-Screen-Token` | `code=200`;含 `token` | | DP-ML-API-004 | Body 登录 | Postman | 已启用;有效密文 | `POST /bigScreen/login`,`{"token":"..."}` | `code=200`;含 `token` | | DP-ML-API-005 | 密文为空 | Postman | 已启用 | `POST /bigScreen/login` 无 token | 失败;大屏登录认证失败 | | DP-ML-API-006 | 密文非法 | Postman | 已启用 | `token=not-valid-cipher` | 失败;大屏登录认证失败 | | DP-ML-API-007 | 专用账号不存在 | Postman | `username` 指向不存在用户 | 有效密文登录 | 失败;大屏专用账号不存在 | | DP-ML-API-007a | 账号已删除 | Postman | `del_flag=2` | 有效密文登录 | 失败;`user.password.delete` | | DP-ML-API-007b | 账号已停用 | Postman | `status=1` | 有效密文登录 | 失败;`user.blocked` | | DP-ML-API-008 | 登录后访问看板 | Postman | 登录成功 | `GET /bigScreen/home/dashboard?statYear=2026`,带 `Authorization` | 200(JWT 含 `bigScreen:*:*`) | **生成有效密文(联调)**: 1. `GET /bigScreen/publicKey` 取 `publicKey` 2. 前端 JSEncrypt 或脚本用公钥加密 `crypto.randomUUID()` 3. 将密文填入 **DP-ML-API-003/004** --- ## 4. 安全与约束 | 编号 | 场景 | 预期 | | --- | --- | --- | | DP-ML-SEC-001 | 私钥不出现在公钥接口响应 | `data` 仅含 `publicKey` | | DP-ML-SEC-002 | 登录接口不校验客户端 IP | 任意 IP 可调用(仍须有效密文) | | DP-ML-SEC-003 | 看板接口未带 JWT | `GET .../dashboard` 返回 401 | --- ## 5. 修订记录 | 版本 | 说明 | | --- | --- | | 1.0 | 初版:RSA 公钥 + UUID 加密登录;路径 `GET /bigScreen/publicKey`、`POST /bigScreen/login` |