This commit is contained in:
cho
2026-01-15 15:49:05 +09:00
parent ec6c5a8b34
commit 92f8e1500c
@@ -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,""));