1. 添加CorsFilter以支持localhost:8000的跨域请求
2. 添加DynamicTaskInfo实体类以用于处理BW系统的body 3. 新添加动态规则生成方法
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package com.realtime.protection.configuration.cors;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@Configuration
|
||||
public class CorsFilter implements WebMvcConfigurer {
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry corsRegistry) {
|
||||
corsRegistry.addMapping("/**")
|
||||
.allowedOrigins("http://localhost:8000")
|
||||
.allowCredentials(true)
|
||||
.allowedMethods("GET", "POST", "DELETE", "PUT")
|
||||
.allowedHeaders("*")
|
||||
.exposedHeaders("*");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.realtime.protection.configuration.entity.task;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class DynamicTaskInfo {
|
||||
|
||||
@Data
|
||||
private static class SimpleProtectObject {
|
||||
private String IP;
|
||||
private Integer port;
|
||||
private String URL;
|
||||
private String protocol;
|
||||
}
|
||||
|
||||
// 从任务中获取
|
||||
private Long taskId;
|
||||
private LocalDateTime startTime;
|
||||
private LocalDateTime endTime;
|
||||
|
||||
// 从规则中获取
|
||||
private Integer ruleId;
|
||||
private String sourceSystem;
|
||||
private String eventType;
|
||||
|
||||
// 从防护对象列表中获取
|
||||
private List<SimpleProtectObject> protectObjects;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.realtime.protection.configuration.response;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SimpleResponse {
|
||||
|
||||
@JsonProperty("code")
|
||||
private Integer code;
|
||||
|
||||
@JsonProperty("success")
|
||||
private Boolean success;
|
||||
}
|
||||
Reference in New Issue
Block a user