|
@@ -32,6 +32,7 @@ import reactor.core.publisher.Mono;
|
|
|
import java.net.URI;
|
|
import java.net.URI;
|
|
|
import java.net.URLEncoder;
|
|
import java.net.URLEncoder;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
import java.nio.charset.StandardCharsets;
|
|
|
|
|
+import java.util.Base64;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Matcher;
|
|
|
import java.util.regex.Pattern;
|
|
import java.util.regex.Pattern;
|
|
@@ -104,8 +105,8 @@ public class RequestDecoderFilter extends AbstractGatewayFilterFactory<Object> {
|
|
|
try{
|
|
try{
|
|
|
String[] pathSegments = path.split("/");
|
|
String[] pathSegments = path.split("/");
|
|
|
String param = pathSegments[pathSegments.length - 1];
|
|
String param = pathSegments[pathSegments.length - 1];
|
|
|
-
|
|
|
|
|
- String decryptStr = cryptoAes.decryptStr(param);
|
|
|
|
|
|
|
+ byte[] decode = Base64.getDecoder().decode(param);
|
|
|
|
|
+ String decryptStr = cryptoAes.decryptStr(new String(decode));
|
|
|
|
|
|
|
|
Pattern pattern = Pattern.compile("(.+/)[^/]+$");
|
|
Pattern pattern = Pattern.compile("(.+/)[^/]+$");
|
|
|
Matcher matcher = pattern.matcher(path);
|
|
Matcher matcher = pattern.matcher(path);
|
|
@@ -140,8 +141,9 @@ public class RequestDecoderFilter extends AbstractGatewayFilterFactory<Object> {
|
|
|
Flux<DataBuffer> modifiedBody = serverRequest.bodyToFlux(String.class).flatMap(body -> {
|
|
Flux<DataBuffer> modifiedBody = serverRequest.bodyToFlux(String.class).flatMap(body -> {
|
|
|
// 解密请求体
|
|
// 解密请求体
|
|
|
try {
|
|
try {
|
|
|
|
|
+ byte[] decode = Base64.getDecoder().decode(body);
|
|
|
// log.info("待解密请求参数:{}", body);
|
|
// log.info("待解密请求参数:{}", body);
|
|
|
- String decryptStr = cryptoAes.decryptStr(body);
|
|
|
|
|
|
|
+ String decryptStr = cryptoAes.decryptStr(new String(decode));
|
|
|
// log.info("解密后参数:{}", decryptStr);
|
|
// log.info("解密后参数:{}", decryptStr);
|
|
|
|
|
|
|
|
DataBufferFactory dataBufferFactory = exchange.getResponse().bufferFactory();
|
|
DataBufferFactory dataBufferFactory = exchange.getResponse().bufferFactory();
|
|
@@ -194,9 +196,10 @@ public class RequestDecoderFilter extends AbstractGatewayFilterFactory<Object> {
|
|
|
if (CharSequenceUtil.isEmpty(decryptedParam)) {
|
|
if (CharSequenceUtil.isEmpty(decryptedParam)) {
|
|
|
return chain.filter(exchange);
|
|
return chain.filter(exchange);
|
|
|
}
|
|
}
|
|
|
|
|
+ byte[] decode = Base64.getDecoder().decode(decryptedParam);
|
|
|
// log.info("GET:{},请求待解密数据 :{}", exchange.getRequest().getURI(),decryptedParam);
|
|
// log.info("GET:{},请求待解密数据 :{}", exchange.getRequest().getURI(),decryptedParam);
|
|
|
- String decryptStr = cryptoAes.decryptStr(decryptedParam);
|
|
|
|
|
- log.info("GET解密后数据 :{}", decryptStr);
|
|
|
|
|
|
|
+ String decryptStr = cryptoAes.decryptStr(new String(decode));
|
|
|
|
|
+// log.info("GET解密后数据 :{}", decryptStr);
|
|
|
|
|
|
|
|
JSONObject decryptJson = JSON.parseObject(decryptStr);
|
|
JSONObject decryptJson = JSON.parseObject(decryptStr);
|
|
|
//构建新的请求参数webflux
|
|
//构建新的请求参数webflux
|