Jelajahi Sumber

feat(评测改造):
1.增加在线查询 ->从西藏版本迁移 ->TokenInfoController
2.增加用户异常IP鉴权预警 - >
detectLogService.checkExceptionIp
3.令牌处理日志:增加接收令牌信息接口,发送到审计 ->
TokenController
4.环境要素录入 -> EnvElementController

chenbh 1 tahun lalu
induk
melakukan
939224dc75

+ 1 - 1
pom.xml

@@ -121,7 +121,7 @@
         <dependency>
             <groupId>com.dragoninfo</groupId>
             <artifactId>dcuc-auth-api</artifactId>
-            <version>2.4.3-tjdsj-SNAPSHOT</version>
+            <version>2.5.0-tjdsj-SNAPSHOT</version>
         </dependency>
 
         <dependency>

+ 38 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/controller/api/v1/controller/TokenController.java

@@ -0,0 +1,38 @@
+package com.dragoninfo.dcuc.authweb.restcontroller.api.controller.api.v1.controller;
+
+import com.dragoninfo.dcuc.auth.api.vo.zerotrust.ZeroTrustBusinessRespEnum;
+import com.dragoninfo.dcuc.auth.token.vo.TokenReceiveVO;
+import com.dragoninfo.dcuc.auth.api.vo.zerotrust.ZeroTustMessageRespVO;
+import com.dragoninfo.dcuc.auth.token.facade.IAuthTokenFacade;
+import com.dragonsoft.duceap.commons.util.json.JsonUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.validation.Valid;
+import java.util.List;
+
+/**
+ * @author mazq
+ * @date 2023/3/8
+ */
+@Slf4j
+@RestController
+@RequestMapping("api/auth-service/v1/token")
+public class TokenController {
+
+    @Autowired
+    private IAuthTokenFacade authTokenFacade;
+
+    @RequestMapping("receive")
+    public ZeroTustMessageRespVO tokenReceive(@Valid @RequestBody List<TokenReceiveVO> tokenReceiveReqVoList) {
+        log.info("权限接收到令牌操作 :{}", JsonUtils.toJSONString(tokenReceiveReqVoList));
+        tokenReceiveReqVoList.forEach(vo -> {
+            authTokenFacade.tokenReceive(vo);
+        });
+        return ZeroTustMessageRespVO.messageEnumMessage(ZeroTrustBusinessRespEnum.SUCCESS);
+    }
+
+}

+ 29 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/element/EnvElementController.java

@@ -1,15 +1,20 @@
 package com.dragoninfo.dcuc.authweb.restcontroller.element;
 
 import com.dragoninfo.dcuc.auth.element.facade.IEnvElementFacade;
+import com.dragoninfo.dcuc.auth.element.vo.ElementUserRelRespVo;
+import com.dragoninfo.dcuc.auth.element.vo.ElementUserSaveVo;
 import com.dragoninfo.dcuc.auth.element.vo.EnvElementSaveVo;
 import com.dragoninfo.dcuc.auth.element.vo.RespEnvElementVo;
+import com.dragoninfo.dcuc.auth.sub.vo.AuthUserVo;
 import com.dragoninfo.duceap.core.response.Result;
 import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
 import com.dragonsoft.duceap.base.entity.search.SearchDTO;
+import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.web.bind.annotation.*;
 
+import javax.validation.Valid;
 import java.util.List;
 
 /**
@@ -59,4 +64,28 @@ public class EnvElementController {
         result.setResult(responseStatus.getStatusCode());
         return result;
     }
+
+    @ApiOperation(value = "关联用户分页查询")
+    @PostMapping("userRelPage")
+    public Result<List<ElementUserRelRespVo>> userRelPage(SearchDTO searchDTO) {
+        return envElementFacade.userRelPage(searchDTO);
+    }
+
+    @ApiOperation(value = "非关联用户分页查询")
+    @PostMapping("notInUserRelPage")
+    public Result<List<AuthUserVo>> notInUserRelPage(SearchDTO searchDTO) {
+        return envElementFacade.notInUserRelPage(searchDTO);
+    }
+
+    @ApiOperation(value = "关联关系添加")
+    @PostMapping("userRelSave")
+    public Result<Object> userRelSave(@Valid @RequestBody ElementUserSaveVo relSaveVo) {
+        return envElementFacade.userRelSave(relSaveVo);
+    }
+
+    @ApiOperation(value = "关联关系移除")
+    @DeleteMapping("deleteUserRel/{id}")
+    public Result<Object> deleteUserRel(@PathVariable("id") String id) {
+        return envElementFacade.deleteUserRel(id);
+    }
 }

+ 30 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/login/TokenInfoController.java

@@ -0,0 +1,30 @@
+package com.dragoninfo.dcuc.authweb.restcontroller.login;
+
+import com.alibaba.fastjson.JSONObject;
+import com.dragoninfo.dcuc.auth.token.facade.IAuthTokenFacade;
+import com.dragoninfo.dcuc.auth.token.vo.TokenOnlineReqVo;
+import com.dragoninfo.dcuc.auth.token.vo.TokenOnlineRespVo;
+import com.dragoninfo.duceap.core.response.Result;
+import org.springframework.beans.factory.annotation.Autowired;
+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;
+
+/**
+ * @author mazq
+ * @date 2023/6/21
+ */
+@RestController
+@RequestMapping(value = "authsvr/v2/token-info")
+public class TokenInfoController {
+
+    @Autowired
+    private IAuthTokenFacade tokenFacade;
+
+    @PostMapping("online-query")
+    public Result<TokenOnlineRespVo> tokenOnlineQuery(@RequestBody TokenOnlineReqVo reqVo) {
+        return tokenFacade.tokenOnlineQuery(reqVo);
+    }
+
+}