mirror of
https://github.com/hpd840321/craftlabs-authorization-sdk.git
synced 2026-06-09 18:10:30 +08:00
184 lines
5.8 KiB
JSON
184 lines
5.8 KiB
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://craftlabs.cn/schemas/craftlabs-auth-config.json",
|
|
"title": "CraftLabs Auth — initialize(config_json)",
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["schemaVersion", "provider", "scenario"],
|
|
"properties": {
|
|
"schemaVersion": {
|
|
"type": "integer",
|
|
"const": 1,
|
|
"description": "配置格式版本;与解析器 AuthConfigs.SCHEMA_VERSION 对齐。"
|
|
},
|
|
"provider": {
|
|
"type": "string",
|
|
"enum": ["bitanswer", "selfhosted"],
|
|
"description": "后端实现:比特安索 native 或自研 HTTP。"
|
|
},
|
|
"scenario": {
|
|
"type": "string",
|
|
"enum": ["wharf", "school", "floating"],
|
|
"description": "业务场景:码头集中授权、学校按边设备、流动人口按项目。"
|
|
},
|
|
"bitanswer": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"description": "provider=bitanswer 时由校验器要求非空且含 url。",
|
|
"properties": {
|
|
"url": {
|
|
"type": "string",
|
|
"description": "Bit_Login szURL:云 http(s)://、集团 bit://、本地 lic:// 等,参见比特文档。"
|
|
},
|
|
"loginMode": {
|
|
"type": "string",
|
|
"description": "与 Bitanswer Java LoginMode 名称一致,如 AUTO、REMOTE、LOCAL。"
|
|
},
|
|
"rootPath": {
|
|
"type": "string",
|
|
"description": "可选;对应 Bit_SetRootPath。"
|
|
},
|
|
"sn": {
|
|
"type": "string",
|
|
"description": "可选;若激活前即固定 SN 可放此处,否则走 activate(licenseKey)。"
|
|
},
|
|
"applicationData": {
|
|
"type": "string",
|
|
"description": "随产品绑定的 application_data,若不由库内编译常量承担。"
|
|
}
|
|
}
|
|
},
|
|
"selfhosted": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"description": "provider=selfhosted 时由校验器要求非空且含 baseUrl。",
|
|
"properties": {
|
|
"baseUrl": {
|
|
"type": "string",
|
|
"format": "uri",
|
|
"description": "自研授权服务根 URL。"
|
|
},
|
|
"tenantKey": {
|
|
"type": "string",
|
|
"description": "可选;租户或调用方标识。"
|
|
},
|
|
"offlineGraceDays": {
|
|
"type": "integer",
|
|
"minimum": 0,
|
|
"maximum": 365,
|
|
"default": 7,
|
|
"description": "离线宽限期(天),断网后允许继续使用的最大天数。"
|
|
},
|
|
"heartbeatIntervalHours": {
|
|
"type": "integer",
|
|
"minimum": 1,
|
|
"maximum": 720,
|
|
"default": 24,
|
|
"description": "心跳间隔(小时)。"
|
|
},
|
|
"publicKeyPem": {
|
|
"type": "string",
|
|
"description": "可选;RSA 公钥 PEM。不填则使用 SDK 内嵌公钥。"
|
|
}
|
|
}
|
|
},
|
|
"features": {
|
|
"type": "object",
|
|
"description": "逻辑特性键 → 比特特征项 id 或名称,供 hasFeature 映射。",
|
|
"additionalProperties": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"bitanswerFeatureId": { "type": "integer" },
|
|
"bitanswerFeatureName": { "type": "string" },
|
|
"selfhostedFeatureKey": { "type": "string" }
|
|
}
|
|
}
|
|
},
|
|
"wharf": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"description": "scenario=wharf 时建议填写。",
|
|
"properties": {
|
|
"topology": {
|
|
"type": "string",
|
|
"enum": ["cloud", "group", "local_float"],
|
|
"description": "云授权、集团授权或单机浮动等拓扑提示。"
|
|
},
|
|
"groupServiceUrl": {
|
|
"type": "string",
|
|
"description": "topology=group 时 bit://host:port。"
|
|
},
|
|
"notes": { "type": "string" }
|
|
}
|
|
},
|
|
"school": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"description": "scenario=school 时建议填写。",
|
|
"properties": {
|
|
"edgeDeviceId": {
|
|
"type": "string",
|
|
"description": "边设备实例标识,用于运营侧对账;不参与比特 API 则仅作遥测/日志。"
|
|
},
|
|
"tenantId": { "type": "string" }
|
|
}
|
|
},
|
|
"floating": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"description": "scenario=floating 时校验器要求 projectId。",
|
|
"properties": {
|
|
"projectId": {
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"description": "项目维度授权锚点。"
|
|
},
|
|
"projectName": { "type": "string" },
|
|
"contractRef": { "type": "string", "description": "合同或订单引用,可选。" }
|
|
}
|
|
}
|
|
},
|
|
"allOf": [
|
|
{
|
|
"if": { "properties": { "provider": { "const": "bitanswer" } } },
|
|
"then": {
|
|
"required": ["bitanswer"],
|
|
"properties": {
|
|
"bitanswer": {
|
|
"type": "object",
|
|
"required": ["url"],
|
|
"properties": { "url": { "type": "string", "minLength": 1 } }
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"if": { "properties": { "provider": { "const": "selfhosted" } } },
|
|
"then": {
|
|
"required": ["selfhosted"],
|
|
"properties": {
|
|
"selfhosted": {
|
|
"type": "object",
|
|
"required": ["baseUrl"],
|
|
"properties": { "baseUrl": { "type": "string", "minLength": 1 } }
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"if": { "properties": { "scenario": { "const": "floating" } } },
|
|
"then": {
|
|
"required": ["floating"],
|
|
"properties": {
|
|
"floating": {
|
|
"type": "object",
|
|
"required": ["projectId"],
|
|
"properties": { "projectId": { "type": "string", "minLength": 1 } }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|