|
|
@ -11,7 +11,6 @@ import org.dromara.common.core.utils.StringUtils;
|
|
|
|
import org.dromara.common.encrypt.annotation.ApiEncrypt;
|
|
|
|
import org.dromara.common.encrypt.annotation.ApiEncrypt;
|
|
|
|
import org.dromara.common.encrypt.properties.ApiDecryptProperties;
|
|
|
|
import org.dromara.common.encrypt.properties.ApiDecryptProperties;
|
|
|
|
import org.springframework.http.HttpMethod;
|
|
|
|
import org.springframework.http.HttpMethod;
|
|
|
|
import org.springframework.http.MediaType;
|
|
|
|
|
|
|
|
import org.springframework.web.method.HandlerMethod;
|
|
|
|
import org.springframework.web.method.HandlerMethod;
|
|
|
|
import org.springframework.web.servlet.HandlerExceptionResolver;
|
|
|
|
import org.springframework.web.servlet.HandlerExceptionResolver;
|
|
|
|
import org.springframework.web.servlet.HandlerExecutionChain;
|
|
|
|
import org.springframework.web.servlet.HandlerExecutionChain;
|
|
|
@ -43,8 +42,6 @@ public class CryptoFilter implements Filter {
|
|
|
|
ServletResponse responseWrapper = null;
|
|
|
|
ServletResponse responseWrapper = null;
|
|
|
|
EncryptResponseBodyWrapper responseBodyWrapper = null;
|
|
|
|
EncryptResponseBodyWrapper responseBodyWrapper = null;
|
|
|
|
|
|
|
|
|
|
|
|
// 是否为 json 请求
|
|
|
|
|
|
|
|
if (StringUtils.startsWithIgnoreCase(request.getContentType(), MediaType.APPLICATION_JSON_VALUE)) {
|
|
|
|
|
|
|
|
// 是否为 put 或者 post 请求
|
|
|
|
// 是否为 put 或者 post 请求
|
|
|
|
if (HttpMethod.PUT.matches(servletRequest.getMethod()) || HttpMethod.POST.matches(servletRequest.getMethod())) {
|
|
|
|
if (HttpMethod.PUT.matches(servletRequest.getMethod()) || HttpMethod.POST.matches(servletRequest.getMethod())) {
|
|
|
|
// 是否存在加密标头
|
|
|
|
// 是否存在加密标头
|
|
|
@ -63,7 +60,7 @@ public class CryptoFilter implements Filter {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 判断是否响应加密
|
|
|
|
// 判断是否响应加密
|
|
|
|
if (responseFlag) {
|
|
|
|
if (responseFlag) {
|
|
|
|
responseBodyWrapper = new EncryptResponseBodyWrapper(servletResponse);
|
|
|
|
responseBodyWrapper = new EncryptResponseBodyWrapper(servletResponse);
|
|
|
|