From 92f8e1500c635478cc0f57a751ab52c38d966ef4 Mon Sep 17 00:00:00 2001 From: cho Date: Thu, 15 Jan 2026 15:49:05 +0900 Subject: [PATCH] =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../filter/HmacSha256VerifyFilterKjb.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/eactive/eai/adapter/http/dynamic/filter/HmacSha256VerifyFilterKjb.java b/src/main/java/com/eactive/eai/adapter/http/dynamic/filter/HmacSha256VerifyFilterKjb.java index 92bed3d..182e48c 100644 --- a/src/main/java/com/eactive/eai/adapter/http/dynamic/filter/HmacSha256VerifyFilterKjb.java +++ b/src/main/java/com/eactive/eai/adapter/http/dynamic/filter/HmacSha256VerifyFilterKjb.java @@ -14,6 +14,7 @@ import javax.servlet.http.HttpServletResponse; //import org.apache.commons.net.util.Base64; import org.springframework.http.HttpStatus; import org.apache.commons.lang3.StringUtils; +import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.JSONValue; @@ -157,18 +158,17 @@ public class HmacSha256VerifyFilterKjb implements HttpAdapterFilter { String outboundBody = (String) resultMessage; try { - - if (outboundBody.startsWith(KJB_ROOTLESS_ARRAY)) { - outboundBody = outboundBody.substring(KJB_ROOTLESS_ARRAY.length()); - - if (outboundBody.endsWith("}")) { - outboundBody = outboundBody.substring(0, outboundBody.length() - 1); - } + + Object root = JSONValue.parse(outboundBody); + + if (root instanceof JSONObject && ((JSONObject) root).containsKey("KJB_ROOTLESS_ARRAY")) { + JSONArray jsonArray = (JSONArray) ((JSONObject) root).get("KJB_ROOTLESS_ARRAY"); + outboundBody = jsonArray.toJSONString(); } - + String clientSecret = assignClientSecret(prop, request); String macBody = calculateHMAC(outboundBody, clientSecret); - + response.addHeader("x-obp-signature-body", macBody); response.addHeader("x-obp-partnercode", request.getHeader("x-obp-partnercode")); response.addHeader("x-obp-txid", prop.getProperty(TransactionContextKeys.TRANSACTION_UUID,""));