feat: init iot-util project with OneNET API integration
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
package com.yixiong.iot.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.noear.solon.annotation.Configuration;
|
||||
import org.noear.solon.annotation.Inject;
|
||||
|
||||
/**
|
||||
* IoT 平台鉴权与 HTTP 配置属性,对应 app.yml 中的 iot.* 节点
|
||||
*/
|
||||
@Data
|
||||
@Configuration
|
||||
@Inject("${iot}")
|
||||
public class IotProperties {
|
||||
|
||||
/** 鉴权配置 */
|
||||
private Auth auth = new Auth();
|
||||
|
||||
/** HTTP 客户端配置 */
|
||||
private Http http = new Http();
|
||||
|
||||
@Data
|
||||
public static class Auth {
|
||||
/** 鉴权版本号 */
|
||||
private String version;
|
||||
/** 资源名称,如 userid/459810 */
|
||||
private String resourceName;
|
||||
/** HMAC 签名密钥(Base64 编码) */
|
||||
private String accessKey;
|
||||
/** 签名算法:sha1 / md5 / sha256 */
|
||||
private String signatureMethod;
|
||||
/** token 有效期(秒) */
|
||||
private long expirationSeconds = 3600;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class Http {
|
||||
/** IoT 平台接口基础地址(新版 HMAC 鉴权) */
|
||||
private String baseUrl;
|
||||
/** 默认产品 ID */
|
||||
private String defaultProductId;
|
||||
/** 旧版 API 基础地址(api-key 鉴权) */
|
||||
private String oldBaseUrl;
|
||||
/** 旧版 API Master Key */
|
||||
private String apiKey;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user