From 12157d5dcbbda99b86b8c0f6cfd7ca194e4eea44 Mon Sep 17 00:00:00 2001 From: chenbowen Date: Tue, 16 Dec 2025 21:34:58 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E4=BF=AE=E5=A4=8D=20databus=20=E5=9C=A8?= =?UTF-8?q?=E5=A4=9A=E5=B1=82=E5=B5=8C=E5=A5=97=E7=9A=84=20json=20?= =?UTF-8?q?=E6=8A=A5=E6=96=87=EF=BC=8C=E7=AD=BE=E5=90=8D=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E7=9A=84=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/util/security/CryptoSignatureUtils.java | 7 ++++++- .../gateway/security/GatewaySecurityFilter.java | 3 +-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/zt-framework/zt-common/src/main/java/com/zt/plat/framework/common/util/security/CryptoSignatureUtils.java b/zt-framework/zt-common/src/main/java/com/zt/plat/framework/common/util/security/CryptoSignatureUtils.java index 6fb4808c..b0d9be83 100644 --- a/zt-framework/zt-common/src/main/java/com/zt/plat/framework/common/util/security/CryptoSignatureUtils.java +++ b/zt-framework/zt-common/src/main/java/com/zt/plat/framework/common/util/security/CryptoSignatureUtils.java @@ -1,6 +1,7 @@ package com.zt.plat.framework.common.util.security; import cn.hutool.crypto.SecureUtil; +import com.zt.plat.framework.common.util.json.JsonUtils; import javax.crypto.Cipher; import javax.crypto.KeyGenerator; @@ -126,7 +127,11 @@ public final class CryptoSignatureUtils { continue; } sb.append(key).append('='); - sb.append(value); + if (value instanceof String || value instanceof Number || value instanceof Boolean) { + sb.append(value); + } else { + sb.append(JsonUtils.toJsonString(value)); + } sb.append('&'); } if (sb.length() > 0) { diff --git a/zt-module-databus/zt-module-databus-server/src/main/java/com/zt/plat/module/databus/framework/integration/gateway/security/GatewaySecurityFilter.java b/zt-module-databus/zt-module-databus-server/src/main/java/com/zt/plat/module/databus/framework/integration/gateway/security/GatewaySecurityFilter.java index 6692f40d..48c2a627 100644 --- a/zt-module-databus/zt-module-databus-server/src/main/java/com/zt/plat/module/databus/framework/integration/gateway/security/GatewaySecurityFilter.java +++ b/zt-module-databus/zt-module-databus-server/src/main/java/com/zt/plat/module/databus/framework/integration/gateway/security/GatewaySecurityFilter.java @@ -286,8 +286,7 @@ public class GatewaySecurityFilter extends OncePerRequestFilter { try { boolean valid = CryptoSignatureUtils.verifySignature(signaturePayload, signatureType); if (!valid) { - log.error("[API-PORTAL] 签名校验失败"); - return; + throw new SecurityValidationException(HttpStatus.UNAUTHORIZED, "签名校验失败"); } } catch (IllegalArgumentException ex) { throw new SecurityValidationException(HttpStatus.INTERNAL_SERVER_ERROR, "签名算法配置异常");