chore: IOT模块单体版本 - 代码合并
This commit is contained in:
@@ -38,4 +38,16 @@ public class IotDeviceRespDTO {
|
||||
*/
|
||||
private String codecType;
|
||||
|
||||
/**
|
||||
* 设备级认证类型
|
||||
* 枚举 {@link com.viewsh.module.iot.core.enums.IotAuthTypeEnum}
|
||||
*/
|
||||
private String authType;
|
||||
|
||||
/**
|
||||
* 产品级认证类型 (兜底策略)
|
||||
* 枚举 {@link com.viewsh.module.iot.core.enums.IotAuthTypeEnum}
|
||||
*/
|
||||
private String productAuthType;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.viewsh.module.iot.core.enums;
|
||||
|
||||
import com.viewsh.framework.common.core.ArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* IoT 认证类型枚举
|
||||
* <p>
|
||||
* 用于产品(Product)和设备(Device)的认证策略配置
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum IotAuthTypeEnum implements ArrayValuable<String> {
|
||||
|
||||
/**
|
||||
* 一机一密:每个设备有独立的 DeviceSecret
|
||||
*/
|
||||
SECRET("SECRET", "一机一密"),
|
||||
|
||||
/**
|
||||
* 一型一密:同产品下所有设备共用 ProductSecret
|
||||
*/
|
||||
PRODUCT_SECRET("PRODUCT_SECRET", "一型一密"),
|
||||
|
||||
/**
|
||||
* 动态注册:设备初次连接时自动创建,通常配合一型一密或免鉴权使用
|
||||
* 注意:这通常是一个"能力开关"而非单纯的"认证方式",但在某些简单模型下可作为一种策略标识
|
||||
* TODO: 暂未实现动态注册
|
||||
*/
|
||||
DYNAMIC("DYNAMIC", "动态注册"),
|
||||
|
||||
/**
|
||||
* 免鉴权:仅校验 ProductKey 和 DeviceName 存在
|
||||
*/
|
||||
NONE("NONE", "免鉴权");
|
||||
|
||||
public static final String[] ARRAYS = Arrays.stream(values()).map(IotAuthTypeEnum::getType).toArray(String[]::new);
|
||||
|
||||
/**
|
||||
* 类型代码
|
||||
*/
|
||||
private final String type;
|
||||
/**
|
||||
* 名字
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
@Override
|
||||
public String[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user