|
@@ -1,62 +0,0 @@
|
|
|
-package com.dragoninfo.dcuc.authweb.restcontroller.api.securitypolicy;
|
|
|
-
|
|
|
-import com.dragoninfo.dcuc.auth.api.vo.securitypolicy.req.ReqUserRiskScoreVO;
|
|
|
-import com.dragoninfo.dcuc.auth.api.vo.securitypolicy.resp.ErrorException;
|
|
|
-import com.dragoninfo.dcuc.auth.api.vo.securitypolicy.resp.HwSecurityPolicyResp;
|
|
|
-import com.dragoninfo.dcuc.auth.securitypolicy.facade.IApiSecurityPolicyFacade;
|
|
|
-import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
-import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
-import io.swagger.annotations.Api;
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
-
|
|
|
-import java.io.IOException;
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
-
|
|
|
- * <p>
|
|
|
- *
|
|
|
- * </p>
|
|
|
- *
|
|
|
- * @author huangzqa
|
|
|
- * @date 2023/5/12
|
|
|
- */
|
|
|
-@Api(tags = {"接收安全策略服务接口"})
|
|
|
-@Slf4j
|
|
|
-@RestController
|
|
|
-@RequestMapping("/api/hw/security-police/")
|
|
|
-public class ApiHwSecurityPolicyController {
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private IApiSecurityPolicyFacade apiHwSecurityPolicyFacade;
|
|
|
-
|
|
|
-
|
|
|
- * 接收评分
|
|
|
- *
|
|
|
- * @return AuthResp
|
|
|
- */
|
|
|
- @PostMapping(value = "/setRiskScore")
|
|
|
- public HwSecurityPolicyResp<Boolean> setRiskScore(@RequestParam(value = "messageID", required = false) String messageId,
|
|
|
- @RequestParam(value = "token", required = false) String token,
|
|
|
- @RequestParam(value = "contents", required = false) String userRiskScoresJson) {
|
|
|
-
|
|
|
- log.info("接收安全策略控制服务指令评分信息 messageId:{},contents:{}", messageId, userRiskScoresJson);
|
|
|
- ObjectMapper objectMapper = new ObjectMapper();
|
|
|
- List<ReqUserRiskScoreVO> userRiskScores;
|
|
|
- try {
|
|
|
- userRiskScores = objectMapper.readValue(userRiskScoresJson, new TypeReference<List<ReqUserRiskScoreVO>>() {
|
|
|
- });
|
|
|
- } catch (IOException e) {
|
|
|
- log.error("messageId:{},contents :{} 解析异常", messageId, userRiskScoresJson, e);
|
|
|
- return HwSecurityPolicyResp.fail("", "contents 解析异常", ErrorException.errorException(e));
|
|
|
- }
|
|
|
-
|
|
|
- apiHwSecurityPolicyFacade.receivePolicy(userRiskScores);
|
|
|
-
|
|
|
- return HwSecurityPolicyResp.success();
|
|
|
- }
|
|
|
-}
|