apps添加私钥
This commit is contained in:
1 parent
051f78b59c
commit
35c7bcc8aa
10 files changed
+152
-79
No files matched your search
@@ -11,7 +11,6 @@ import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.domain.Apps;
|
||||
import com.ruoyi.system.domain.AppsPlus;
|
||||
import com.ruoyi.system.service.IAppsService;
|
||||
import com.ruoyi.system.domain.dto.AppPublicKeyRequest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -44,44 +43,22 @@ public class AppsController extends BaseController {
|
||||
return AjaxResult.success(appsService.getGlobalAggregationAddress());
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成 RSA 密钥对。私钥只在本次响应中返回,因此禁止操作日志保存响应体。
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:apps:add')")
|
||||
@Log(title = "生成商户 RSA 密钥对", businessType = BusinessType.OTHER,
|
||||
isSaveRequestData = false, isSaveResponseData = false)
|
||||
@PostMapping("/generate-key-pair")
|
||||
public AjaxResult generateKeyPair() {
|
||||
return AjaxResult.success(appsService.generateKeyPair());
|
||||
}
|
||||
|
||||
/** 商户端生成 RSA 密钥对,私钥同样不保存。 */
|
||||
@PreAuthorize("@ss.hasPermi('system:apps:user-add')")
|
||||
@Log(title = "商户生成 RSA 密钥对", businessType = BusinessType.OTHER,
|
||||
isSaveRequestData = false, isSaveResponseData = false)
|
||||
@PostMapping("/user/generate-key-pair")
|
||||
public AjaxResult userGenerateKeyPair() {
|
||||
return AjaxResult.success(appsService.generateKeyPair());
|
||||
}
|
||||
|
||||
/** 单独设置商户公钥。 */
|
||||
/** 由系统轮换商户 RSA 密钥对,私钥加密保存且不返回。 */
|
||||
@PreAuthorize("@ss.hasPermi('system:apps:edit')")
|
||||
@Log(title = "设置商户公钥", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/{id}/public-key")
|
||||
public AjaxResult updatePublicKey(@PathVariable("id") Long id,
|
||||
@RequestBody AppPublicKeyRequest request) {
|
||||
return toAjax(appsService.updatePublicKey(id,
|
||||
request == null ? null : request.getPublicKey(), false));
|
||||
@Log(title = "轮换商户 RSA 密钥对", businessType = BusinessType.UPDATE,
|
||||
isSaveRequestData = false, isSaveResponseData = false)
|
||||
@PutMapping("/{id}/key-pair")
|
||||
public AjaxResult rotateKeyPair(@PathVariable("id") Long id) {
|
||||
return toAjax(appsService.rotateKeyPair(id, false));
|
||||
}
|
||||
|
||||
/** 商户端单独设置自己的公钥。 */
|
||||
/** 商户端轮换自己的 RSA 密钥对。 */
|
||||
@PreAuthorize("@ss.hasPermi('system:apps:user-edit')")
|
||||
@Log(title = "商户设置公钥", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/user/{id}/public-key")
|
||||
public AjaxResult userUpdatePublicKey(@PathVariable("id") Long id,
|
||||
@RequestBody AppPublicKeyRequest request) {
|
||||
return toAjax(appsService.updatePublicKey(id,
|
||||
request == null ? null : request.getPublicKey(), true));
|
||||
@Log(title = "商户轮换 RSA 密钥对", businessType = BusinessType.UPDATE,
|
||||
isSaveRequestData = false, isSaveResponseData = false)
|
||||
@PutMapping("/user/{id}/key-pair")
|
||||
public AjaxResult userRotateKeyPair(@PathVariable("id") Long id) {
|
||||
return toAjax(appsService.rotateKeyPair(id, true));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:apps:getByIds')")
|
||||
|
||||
Reference in new issue
Block a user