feat: add provider login flow (#4)
## Summary - replace the former three-provider model with two pre-login choices: - **ABox**: authenticate through the vendor ABSDK on the current local network - **Local experience**: establish a production simulation session without credentials, network access, or ABSDK calls - remove the compatible-backend product/server scope and safely ignore legacy persisted compatible-provider values - bind one process-wide `AbsdkBridge` for ABox session, socket, temperature/humidity, and infrared operations - add production `:runtime:simulation` implementations and route device operations by the active provider - retain provider-scoped username preferences, Keystore-encrypted automatic-login credentials, token recovery, logout, and session isolation - add regression coverage for authentication gating, profile/session alignment, provider switching cleanup, routing, and simulation behavior - align requirement, plan, architecture, and protocol documentation with LAN ABSDK access ## Verification ```text ./gradlew check testDebugUnitTest test BUILD SUCCESSFUL (220 actionable tasks) ./gradlew :android:app:assembleDebug :android:app:assembleRelease BUILD SUCCESSFUL (217 actionable tasks) ./gradlew :android:app:compileDebugAndroidTestKotlin BUILD SUCCESSFUL git diff --check passed ``` Emulator smoke validation: - provider selection displays ABox and Local experience only - Local experience enters the authenticated route without credentials - Local experience also enters while emulator Wi-Fi/data are disabled - Local Sign out and Switch provider return to provider selection - ABox opens the credential form; empty submission stays on login with the required-fields error ## Known constraints and accepted risks - The vendor JAR uses cleartext HTTP and hardcodes `a-box.com.cn`; Debug and Release intentionally share the same ABox capability under the approved no-Release-exception decision. `@CleartextAbsdkTransport`, `usesCleartextTraffic`, and the architecture/protocol documents explicitly record this risk. This does not provide confidentiality or integrity. - Real authenticated ABox and read-only hardware smoke validation is deferred because the gateway is currently unavailable locally. This PR does not claim that current-environment validation completed. - The mapping from the vendor JAR's hardcoded hostname to the LAN gateway remains an external network/deployment prerequisite. The ABSDK JAR and bridge path remain identical to the previously hardware-validated `feat/moler-infrared-control` branch. - `FakeDeviceCatalog` remains a temporary debug-only placeholder until the device-catalog module provides the production ABox catalog. ABox catalog requests are not routed to Local experience simulation. Reviewed-on: #4 Co-authored-by: KremeCN <3265494849@qq.com>
This commit was merged in pull request #4.
This commit is contained in:
+28
-13
@@ -11,7 +11,7 @@
|
||||
- 历史 Sample:`samples/abox-sdk-sample/login-mac/`;
|
||||
- 公开 API 使用 `javap` 验证,协议细节通过授权字节码分析验证。
|
||||
|
||||
本文不是自有兼容后端的最终规范。真实连接参数、部署行为和硬件结果仍须通过授权测试环境验证。
|
||||
本文只记录厂商 JAR 与局域网环境的已确认行为,不定义任何兼容服务端规范。尚未验证的内容见文末清单,不得作为产品实现承诺。
|
||||
|
||||
## 2. JAR 公开类型
|
||||
|
||||
@@ -108,7 +108,7 @@ commons-logging-1.1.3.jar
|
||||
|
||||
JAR 内含宽松的 TLS 信任实现。正式产品不得把这一历史传输行为扩展为 App 其他网络请求的安全策略,也不得记录密码、Token、API Key 或敏感红外载荷。
|
||||
|
||||
真实 Bridge 工厂使用 `@CleartextAbsdkTransport` 作为编译期 opt-in 门禁,并且当前没有接入 Android App。该标记只防止误接入,不会为链路提供加密。生产集成前必须确定并批准 HTTPS、受控加密代理或其他能够提供机密性与完整性的传输控制;在此之前不得启用真实 ABox 入口。
|
||||
App 组合根绑定真实 Bridge 时使用 `@CleartextAbsdkTransport` 作为编译期 opt-in 门禁,并声明 `INTERNET` 权限与明文传输许可。该标记只防止误接入,不会为链路提供加密;允许明文是项目所有者对当前局域网集成约束的明确风险接受,不代表传输具备机密性或完整性。
|
||||
|
||||
## 6. `setHostInfo` 的已确认行为
|
||||
|
||||
@@ -127,7 +127,7 @@ roomNo
|
||||
apikey
|
||||
```
|
||||
|
||||
其中第一个参数只写入请求字段 `url`,不会修改 SDK 的硬编码 HTTP 基础地址。因此原始 JAR 不能通过该公开 API 直接切换到任意自有后端。
|
||||
其中第一个参数只写入请求字段 `url`,不会修改 SDK 的硬编码 HTTP 基础地址(见第 5 节)。因此该公开 API 不能用于切换请求目标。
|
||||
|
||||
仍未确认:
|
||||
|
||||
@@ -136,9 +136,23 @@ apikey
|
||||
- hotel、room 和 API Key 的正式取值;
|
||||
- 初始化失败对后续登录和设备操作的影响。
|
||||
|
||||
所以 `feat/absdk-bridge` 不实现或调用 `setHostInfo`。
|
||||
Bridge 不实现或调用 `setHostInfo`。
|
||||
|
||||
## 7. MVP 端点与数据
|
||||
## 7. 局域网网关观测证据(2026-08-24)
|
||||
|
||||
以下为 2026-08-24 在网关所在局域网内获得的观测结果,仅描述当天环境,不构成通用承诺:
|
||||
|
||||
- 网关地址 `192.168.100.1` 在端口 80 和 443 上可达;
|
||||
- 未携带 Token 直接 `POST http://192.168.100.1/abox/index.php/abjhsdk/user/validate` 返回 `code=00000`、`status=0`;
|
||||
- `feat/moler-infrared-control` 分支的真实硬件测试表明:当前网络环境下,厂商 JAR 能够到达真实网关并完成红外相关操作。
|
||||
|
||||
同时必须保留以下边界:
|
||||
|
||||
- JAR 仍然硬编码基础地址 `a-box.com.cn`;它在该环境中被映射到局域网网关的机制属于外部环境依赖,机制未知,且不受 `setHostInfo` 影响;
|
||||
- 尚未建立 JAR 可用的通用基础地址或主机配置能力,也没有完成携带授权凭据的登录冒烟验证;
|
||||
- 观测结果不能外推为“任意网络下均可连通”,后续环境变化须重新验证。
|
||||
|
||||
## 8. MVP 端点与数据
|
||||
|
||||
| SDK 方法 | 端点 | 关键参数或返回 |
|
||||
|---|---|---|
|
||||
@@ -154,7 +168,7 @@ apikey
|
||||
|
||||
`downloadIrCodes(List<IrInfo>)` 并不是单次批量 HTTP 请求。JAR 按输入顺序逐项调用下载端点,并返回每项 `status`。只要有任一项失败,总体代码为 `20204`,同时 `dicDatas["ret"]` 仍包含逐项结果。
|
||||
|
||||
## 8. 请求签名
|
||||
## 9. 请求签名
|
||||
|
||||
字节码显示 SDK 会:
|
||||
|
||||
@@ -165,9 +179,9 @@ apikey
|
||||
5. 按时间戳计算的位置插入时间片段并添加固定前缀;
|
||||
6. 在请求的 `system` 数据中提交签名、时间戳和 Token。
|
||||
|
||||
这些事实用于判断协议边界,不在本轮重新实现签名算法或对外宣称兼容性。正式兼容后端开始前,必须建立脱敏签名测试向量并复核每个字段和编码细节。
|
||||
这些事实用于判断协议边界,本轮不重新实现签名算法,也不对外宣称兼容性。任何需要复现该协议行为的工作开始前,必须先建立脱敏签名测试向量并复核每个字段和编码细节。
|
||||
|
||||
## 9. 响应结构
|
||||
## 10. 响应结构
|
||||
|
||||
字节码解析的响应结构为:
|
||||
|
||||
@@ -183,7 +197,7 @@ apikey
|
||||
|
||||
当前 Bridge 对成功数据进行防御性解析:缺失字段、未知状态或错误类型不会导致 `ClassCastException` 泄漏到调用方。
|
||||
|
||||
## 10. 错误码来源
|
||||
## 11. 错误码来源
|
||||
|
||||
完整错误码表来自厂商文档和历史 `AboxConstants.java`。Bridge 保留原始 `externalCode`,并映射为以下领域分类:
|
||||
|
||||
@@ -199,7 +213,7 @@ apikey
|
||||
|
||||
错误 `msg` 只作为诊断 detail,不直接作为最终 UI 文案。
|
||||
|
||||
## 11. 历史 Sample 观察
|
||||
## 12. 历史 Sample 观察
|
||||
|
||||
历史 Sample:
|
||||
|
||||
@@ -212,14 +226,15 @@ apikey
|
||||
|
||||
正式实现只复用已确认的 SDK 调用事实,不复制 AsyncTask、明文凭据或全局明文网络配置。
|
||||
|
||||
## 12. 仍待确认
|
||||
## 13. 仍待确认
|
||||
|
||||
- ABox 官方初始化的完整流程和参数;
|
||||
- 文档所称 Token 两小时有效期在真实环境中的精确表现;
|
||||
- Token 失效时各设备接口实际返回的代码;
|
||||
- SDK 的厂商线程安全保证;
|
||||
- 真实账号、设备名称和硬件环境;
|
||||
- 原始 JAR 指向自有兼容后端的最终授权方案;
|
||||
- 授权凭据下完整的 ABox 登录与设备操作冒烟验证;
|
||||
- JAR 硬编码域名与局域网网关地址之间的映射机制(第 7 节);
|
||||
- 网络环境变化(不同网段、DHCP、路由策略)下连通性是否保持;
|
||||
- ABSDK 和附属 JAR 的生产分发许可;
|
||||
- 所有端点的完整表单编码和可重复签名测试向量。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user