feat:【IoT 物联网】增加网关 HTTP 协议的鉴权,基于 JWT 轻量级(已测试)

This commit is contained in:
YunaiV
2025-06-03 22:27:04 +08:00
parent 643cc4cfd2
commit a0a26c3d64
5 changed files with 19 additions and 11 deletions

View File

@@ -10,6 +10,7 @@ import jakarta.annotation.security.PermitAll;
import org.springframework.context.annotation.Primary;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@@ -30,7 +31,7 @@ public class IoTDeviceApiImpl implements IotDeviceCommonApi {
@Override
@PostMapping(RpcConstants.RPC_API_PREFIX + "/iot/device/auth")
@PermitAll
public CommonResult<Boolean> authDevice(IotDeviceAuthReqDTO authReqDTO) {
public CommonResult<Boolean> authDevice(@RequestBody IotDeviceAuthReqDTO authReqDTO) {
return success(deviceService.authDevice(authReqDTO));
}

View File

@@ -235,6 +235,6 @@ public interface IotDeviceService {
* @param authReqDTO 认证信息
* @return 是否认证成功
*/
boolean authDevice(IotDeviceAuthReqDTO authReqDTO);
boolean authDevice(@Valid IotDeviceAuthReqDTO authReqDTO);
}