增加权限码

This commit is contained in:
liulu 2024-12-18 09:35:30 +08:00
parent 9cb9b43052
commit f19891c39d
2 changed files with 15 additions and 0 deletions

View File

@ -39,6 +39,7 @@ public class KeyManageController {
* @return 分页列表
*/
@PostMapping("/pageList")
@AuthCode(AuthCodeConst.key_list)
public R<Page<KeyInfoResp>> queryPageList(@RequestBody KeyInfoQuery query) {
Page<KeyInfoResp> page = keyManageService.queryPageList(query);
return R.data(page);
@ -51,6 +52,7 @@ public class KeyManageController {
* @return 分页列表
*/
@PostMapping("/info")
@AuthCode(AuthCodeConst.key_info)
public R<KeyInfoResp> queryInfo(@RequestBody Long id) {
Assert.notNull(id, "密钥id不能为空");
KeyInfoResp resp = keyManageService.queryInfo(id);
@ -63,6 +65,7 @@ public class KeyManageController {
* @return id
*/
@PostMapping("/gen")
@AuthCode(AuthCodeConst.key_create)
public R<Long> save(@Valid @RequestBody KeyCreateReq req) {
Long id = keyManageService.create(req);
return R.data(id);
@ -75,6 +78,7 @@ public class KeyManageController {
* @return id
*/
@PostMapping("/update")
@AuthCode(AuthCodeConst.key_update)
public R<Void> update(@Valid @RequestBody KeyUpdateReq req) {
keyManageService.update(req);
return R.ok();
@ -100,6 +104,7 @@ public class KeyManageController {
* @return id
*/
@PostMapping("/disable")
@AuthCode(AuthCodeConst.key_disable)
public R<Void> disableKey(@Valid @RequestBody KeyManageReq req) {
keyManageService.disableKey(req.getIds());
return R.ok();
@ -112,6 +117,7 @@ public class KeyManageController {
* @return id
*/
@PostMapping("/archive")
@AuthCode(AuthCodeConst.key_archive)
public R<Void> archiveKey(@Valid @RequestBody KeyManageReq req) {
keyManageService.archiveKey(req.getIds());
return R.ok();
@ -124,6 +130,7 @@ public class KeyManageController {
* @return id
*/
@PostMapping("/destroy")
@AuthCode(AuthCodeConst.key_destroy)
public R<Void> destroyKey(@Valid @RequestBody KeyManageReq req) {
keyManageService.destroyKey(req.getIds());
return R.ok();

View File

@ -1,5 +1,7 @@
package com.sunyard.chsm.controller;
import com.sunyard.chsm.auth.AuthCode;
import com.sunyard.chsm.constant.AuthCodeConst;
import com.sunyard.chsm.model.R;
import com.sunyard.chsm.param.SymDecryptReq;
import com.sunyard.chsm.param.SymDecryptResp;
@ -42,6 +44,7 @@ public class SymKeyController {
* @return
*/
@PostMapping("/encrypt")
@AuthCode(AuthCodeConst.sym_enc)
public R<SymEncryptResp> encrypt(@Valid @RequestBody SymEncryptReq req) {
SymEncryptResp resp = symKeyService.encrypt(req);
return R.data(resp);
@ -54,6 +57,7 @@ public class SymKeyController {
* @return
*/
@PostMapping("/decrypt")
@AuthCode(AuthCodeConst.sym_dec)
public R<SymDecryptResp> decrypt(@Valid @RequestBody SymDecryptReq req) {
SymDecryptResp resp = symKeyService.decrypt(req);
return R.data(resp);
@ -66,6 +70,7 @@ public class SymKeyController {
* @return
*/
@PostMapping("/hmac")
@AuthCode(AuthCodeConst.cal_hmac)
public R<SymHmacResp> hmac(@Valid @RequestBody SymHmacReq req) {
SymHmacResp resp = symKeyService.hmac(req);
return R.data(resp);
@ -78,6 +83,7 @@ public class SymKeyController {
* @return
*/
@PostMapping("/hmac/check")
@AuthCode(AuthCodeConst.check_hmac)
public R<SymHmacCheckResp> macCheck(@Valid @RequestBody SymHmacCheckReq req) {
SymHmacCheckResp resp = symKeyService.hmacCheck(req);
return R.data(resp);
@ -90,6 +96,7 @@ public class SymKeyController {
* @return
*/
@PostMapping("/mac")
@AuthCode(AuthCodeConst.cal_mac)
public R<SymMacResp> mac(@Valid @RequestBody SymMacReq req) {
SymMacResp resp = symKeyService.mac(req);
return R.data(resp);
@ -102,6 +109,7 @@ public class SymKeyController {
* @return
*/
@PostMapping("/mac/check")
@AuthCode(AuthCodeConst.check_mac)
public R<SymMacCheckResp> macCheck(@Valid @RequestBody SymMacCheckReq req) {
SymMacCheckResp resp = symKeyService.macCheck(req);
return R.data(resp);