设备和token

This commit is contained in:
liulu
2024-12-06 15:38:22 +08:00
parent bcf8dfb5f3
commit 04cfab2f82
25 changed files with 588 additions and 25 deletions
@@ -1,17 +1,49 @@
package com.sunyard.chsm.controller;
import com.sunyard.chsm.param.AppTokenReq;
import com.sunyard.chsm.param.AppTokenResp;
import com.sunyard.chsm.service.AppLoginService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
/**
* 应用Token服务接口
*
* @author liulu
* @version V1.0
* @since 2023/8/4
* @since 2024/12/4
*/
@RestController
@RequestMapping
public class AppLoginController {
@Resource
private AppLoginService appLoginService;
/**
* 获取应用Token接口
* 密码服务平台为各个接入应用提供生成应用授权Token,
* 接入应用需在密码服务平台获取了到平台分配的appKey和appSecret
*
* @param appTokenReq 请求参数
* @return
*/
@PostMapping("/appUser/getAppToken")
public AppTokenResp getAppToken(@Valid @RequestBody AppTokenReq appTokenReq) {
return appLoginService.getAppToken(appTokenReq);
}
@PostMapping("/appUser/getAppTokenTest")
public AppTokenResp getAppTokenForTest(@Valid @RequestBody AppTokenReq appTokenReq) {
return appLoginService.getAppTokenForTest(appTokenReq);
}
}
@@ -0,0 +1,39 @@
package com.sunyard.chsm.controller;
import com.sunyard.chsm.model.R;
import com.sunyard.chsm.model.dto.KeyInfoDTO;
import com.sunyard.chsm.service.KeyInfoService;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* 密钥管理类接口
*
* @author liulu
* @since 2024/12/6
*/
@RestController
@RequestMapping("/key/manage")
public class KeyManageController {
@Resource
private KeyInfoService keyInfoService;
/**
* 启用密钥
*
* @param param 密钥id
* @return id
*/
@PostMapping("/enable")
public R<Void> enableKey(@Validated @RequestBody KeyInfoDTO.IDs param) {
keyInfoService.enableKey(param.getIds());
return R.ok();
}
}