123
This commit is contained in:
@@ -3,6 +3,7 @@ package com.ruoyi;
|
|||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.context.metrics.buffering.BufferingApplicationStartup;
|
import org.springframework.boot.context.metrics.buffering.BufferingApplicationStartup;
|
||||||
|
import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -99,3 +99,5 @@ agora:
|
|||||||
yunxin:
|
yunxin:
|
||||||
app-key: 0aaefeb8a80a9889987c5346244b58e2
|
app-key: 0aaefeb8a80a9889987c5346244b58e2
|
||||||
app-secret: 470345ca2832
|
app-secret: 470345ca2832
|
||||||
|
cai:
|
||||||
|
enable-api-encryption: false
|
||||||
|
|||||||
@@ -2,14 +2,12 @@ package com.ruoyi.cai.filter;
|
|||||||
|
|
||||||
import com.ruoyi.cai.config.CaiProperties;
|
import com.ruoyi.cai.config.CaiProperties;
|
||||||
import com.ruoyi.cai.util.AES;
|
import com.ruoyi.cai.util.AES;
|
||||||
import lombok.SneakyThrows;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.AntPathMatcher;
|
import org.springframework.util.AntPathMatcher;
|
||||||
|
|
||||||
import javax.servlet.*;
|
import javax.servlet.*;
|
||||||
import javax.servlet.annotation.WebFilter;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -18,12 +16,12 @@ import java.util.Set;
|
|||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@WebFilter(urlPatterns = "/api/**", filterName = "encryptionFilter")
|
|
||||||
public class EncryptionFilter implements Filter {
|
public class EncryptionFilter implements Filter {
|
||||||
private static final Set<String> IGNORE_URL = new HashSet<>();
|
private static final Set<String> IGNORE_URL = new HashSet<>();
|
||||||
static {
|
static {
|
||||||
IGNORE_URL.add("/api/ali/notify");
|
IGNORE_URL.add("/api/ali/notify");
|
||||||
IGNORE_URL.add("/api/wx/notify");
|
IGNORE_URL.add("/api/wx/notify");
|
||||||
|
IGNORE_URL.add("/api/yx/im/notify");
|
||||||
}
|
}
|
||||||
private static final AntPathMatcher ANT_PATH_MATCHER = new AntPathMatcher();
|
private static final AntPathMatcher ANT_PATH_MATCHER = new AntPathMatcher();
|
||||||
|
|
||||||
@@ -44,6 +42,10 @@ public class EncryptionFilter implements Filter {
|
|||||||
HttpServletRequest request = (HttpServletRequest) servletRequest;
|
HttpServletRequest request = (HttpServletRequest) servletRequest;
|
||||||
HttpServletResponse originalResponse = (HttpServletResponse) servletResponse;
|
HttpServletResponse originalResponse = (HttpServletResponse) servletResponse;
|
||||||
String requestURI = request.getRequestURI();
|
String requestURI = request.getRequestURI();
|
||||||
|
if(!ANT_PATH_MATCHER.match("/api/**",requestURI)){
|
||||||
|
filterChain.doFilter(servletRequest, servletResponse);
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (String ignoreUrlMatch : IGNORE_URL) {
|
for (String ignoreUrlMatch : IGNORE_URL) {
|
||||||
boolean match = ANT_PATH_MATCHER.match(ignoreUrlMatch, requestURI);
|
boolean match = ANT_PATH_MATCHER.match(ignoreUrlMatch, requestURI);
|
||||||
if(match){
|
if(match){
|
||||||
@@ -67,4 +69,8 @@ public class EncryptionFilter implements Filter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void destroy() {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user