1、staticrule增加事件类型字段

This commit is contained in:
PushM
2024-05-31 14:37:46 +08:00
parent 560f72e826
commit a5fc7922fc
4 changed files with 29 additions and 10 deletions

View File

@@ -163,6 +163,9 @@ public class StaticRuleObject {
@Schema(description = "审核用户部门", example = "部门1")
private String auditUserDepart;
@Schema(description = "事件类型", example = "DDos")
private String eventType;
public void checkAuditStatusValidate(AuditStatusEnum newAuditStatus) {
if (!List.of(AuditStatusEnum.AUDITED.getNum(), AuditStatusEnum.USING.getNum()).contains(this.getAuditStatus())) {

View File

@@ -1,8 +1,10 @@
package com.realtime.protection.server.defense.templatenew;
import com.realtime.protection.configuration.entity.defense.template.TemplateNew;
import com.realtime.protection.configuration.entity.user.UserFull;
import com.realtime.protection.configuration.response.ResponseResult;
import com.realtime.protection.configuration.utils.enums.audit.AuditStatusEnum;
import jakarta.servlet.http.HttpSession;
import jakarta.validation.Valid;
import jakarta.validation.constraints.Min;
import org.springframework.web.bind.annotation.*;
@@ -24,7 +26,14 @@ public class TemplateController implements TemplateNewCpntrollerApi{
@Override
@PostMapping("/new")
public ResponseResult newTemplate(@RequestBody @Valid TemplateNew template) {
//从http首部session字段获取用户信息
// HttpSession session = request.getSession();
// UserFull user = (UserFull) session.getAttribute("user");
// if (user != null) {
// object.setStaticRuleCreateUsername(user.name);
// object.setStaticRuleCreateUserId(Integer.valueOf(user.uid));
// object.setStaticRuleCreateDepart(user.getOrgName());
// }
Integer templateId = templateService.newTemplate(template);
if (templateId > 0) {

View File

@@ -60,11 +60,12 @@ public class LoginService {
.build();
Request request = new Request.Builder()
.url("https://114.243.134.122:10217/passport/accessToken?grant_type=client_credentials")
// .url("https://passport.iam.pub/passport/accessToken?grant_type=client_credentials")
.header("Authorization", "Basic TlNBRERAWlguT1JHOk14a1hHZ1ltOUNROUE3TCRSOCNLRW02R1pSeEhwd1c2")
.post(okhttp3.internal.Util.EMPTY_REQUEST)
.build();
// .url("https://114.243.134.122:10217/passport/accessToken?grant_type=client_credentials")
.url("https://passport.iam.pub/passport/accessToken?grant_type=client_credentials")
// .header("Authorization", "Basic TlNBRERAWlguT1JHOk14a1hHZ1ltOUNROUE3TCRSOCNLRW02R1pSeEhwd1c2")
.header("Authorization", "Basic TlNBREQ6bkhRbE5zN3lLeVd5bzJOc2JmNk5oRmFhYmlWWUlBU1NsdWJRZ3pUaDhOU2xOUkE1V2xQUTF3PT0=")
.post(okhttp3.internal.Util.EMPTY_REQUEST)
.build();
try {
Response response = client.newCall(request).execute();
String rsp = response.body().string();