mirror of
https://github.com/hpd840321/craftlabs-authorization-sdk.git
synced 2026-06-09 18:10:30 +08:00
f94f03bcc2
Add craftlabs-auth-config.schema.json, Java AuthConfigs model with tests, example configs aligned to BP-10, C/Java/auth-config documentation, native header notes, RELEASING guide, and workflow to verify SDK artifact checksums on release tags. Made-with: Cursor
36 lines
1.6 KiB
Markdown
36 lines
1.6 KiB
Markdown
# `initialize(config_json)` 配置说明
|
||
|
||
`AuthProvider.initialize(String)` 与 C API `auth_initialize(const char* config_json)` 共用同一 JSON 语义,版本由 **`schemaVersion: 1`** 锁定。
|
||
|
||
## 规范与示例
|
||
|
||
| 资源 | 路径 |
|
||
|------|------|
|
||
| JSON Schema | `schemas/craftlabs-auth-config.schema.json` |
|
||
| 码头 / 集团拓扑示例 | `examples/config/wharf.bitanswer.json` |
|
||
| 学校 / 边设备示例 | `examples/config/school.bitanswer.json` |
|
||
| 流动人口 / 项目示例 | `examples/config/floating.bitanswer.json` |
|
||
| 学校 / 自研 HTTP 示例 | `examples/config/school.selfhosted.json` |
|
||
|
||
## Java 解析与校验
|
||
|
||
```java
|
||
import cn.craftlabs.auth.config.AuthConfig;
|
||
import cn.craftlabs.auth.config.AuthConfigException;
|
||
import cn.craftlabs.auth.config.AuthConfigs;
|
||
|
||
AuthConfig cfg = AuthConfigs.parse(jsonString);
|
||
// 再交给实现(与校验使用同一字符串即可)
|
||
provider.initialize(jsonString);
|
||
```
|
||
|
||
`AuthConfig` 提供 `bitanswerFeatureId(String logicalKey)` 等辅助方法,供后续在 `hasFeature` 与比特 `QueryFeature` 之间做映射。
|
||
|
||
## 场景字段摘要
|
||
|
||
- **wharf**:`wharf.topology`(`cloud` / `group` / `local_float`)等与集中授权拓扑相关的**提示**;实际连网方式仍以 `bitanswer.url` 为准。
|
||
- **school**:`school.edgeDeviceId` 等用于运营对账;是否写入比特自定义字段由实现阶段决定。
|
||
- **floating**:**必填** `floating.projectId`;表达「按项目」授权锚点,与商务合同、控制台业务模板需一致。
|
||
|
||
后续优化(错误码、OIDC、集团占点策略等)在保持 `schemaVersion` 或递增版本的前提下扩展字段即可。
|