|
@@ -127,16 +127,6 @@ public class AuthGatewayFilterFactory extends AbstractGatewayFilterFactory<HostL
|
|
|
logger.warn("Could not get local address!");
|
|
|
}
|
|
|
}
|
|
|
- // 获取 request body
|
|
|
- AtomicReference<String> requestBody = new AtomicReference<>("");
|
|
|
- // 复用现成的 decorator
|
|
|
- RecorderServerHttpRequestDecorator requestDecorator = new RecorderServerHttpRequestDecorator(request);
|
|
|
- Flux<DataBuffer> body = requestDecorator.getBody();
|
|
|
- body.subscribe(buffer -> {
|
|
|
- CharBuffer charBuffer = StandardCharsets.UTF_8.decode(buffer.asByteBuffer());
|
|
|
- requestBody.set(charBuffer.toString());
|
|
|
- });
|
|
|
- String bodyStr = requestBody.get();
|
|
|
try {
|
|
|
String auth = config.getAuth();
|
|
|
String protocol = config.getProtocol();
|
|
@@ -249,6 +239,17 @@ public class AuthGatewayFilterFactory extends AbstractGatewayFilterFactory<HostL
|
|
|
//判断是否需要验证checksum
|
|
|
if (appInfo.isChecksum()) {
|
|
|
String checksum = (String) payload.getClaim(KEY_CHECKSUM);
|
|
|
+ // FIXME: the following code snippet may have issues with `java.lang.IllegalStateException: Rejecting additional inbound receiver.`
|
|
|
+ // 获取 request body
|
|
|
+ AtomicReference<String> requestBody = new AtomicReference<>("");
|
|
|
+ // 复用现成的 decorator
|
|
|
+ RecorderServerHttpRequestDecorator requestDecorator = new RecorderServerHttpRequestDecorator(request);
|
|
|
+ Flux<DataBuffer> body = requestDecorator.getBody();
|
|
|
+ body.subscribe(buffer -> {
|
|
|
+ CharBuffer charBuffer = StandardCharsets.UTF_8.decode(buffer.asByteBuffer());
|
|
|
+ requestBody.set(charBuffer.toString());
|
|
|
+ });
|
|
|
+ String bodyStr = requestBody.get();
|
|
|
if (!DigestUtil.md5Hex(bodyStr).equals(checksum)) {
|
|
|
throw new HttpMsgException(HttpStatus.INTERNAL_SERVER_ERROR, HTTP_STATUS_CODE_601,
|
|
|
"Checksum Error");
|