수정
This commit is contained in:
+9
-9
@@ -14,6 +14,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
//import org.apache.commons.net.util.Base64;
|
//import org.apache.commons.net.util.Base64;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.json.simple.JSONArray;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import org.json.simple.JSONValue;
|
import org.json.simple.JSONValue;
|
||||||
|
|
||||||
@@ -157,18 +158,17 @@ public class HmacSha256VerifyFilterKjb implements HttpAdapterFilter {
|
|||||||
String outboundBody = (String) resultMessage;
|
String outboundBody = (String) resultMessage;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (outboundBody.startsWith(KJB_ROOTLESS_ARRAY)) {
|
Object root = JSONValue.parse(outboundBody);
|
||||||
outboundBody = outboundBody.substring(KJB_ROOTLESS_ARRAY.length());
|
|
||||||
|
if (root instanceof JSONObject && ((JSONObject) root).containsKey("KJB_ROOTLESS_ARRAY")) {
|
||||||
if (outboundBody.endsWith("}")) {
|
JSONArray jsonArray = (JSONArray) ((JSONObject) root).get("KJB_ROOTLESS_ARRAY");
|
||||||
outboundBody = outboundBody.substring(0, outboundBody.length() - 1);
|
outboundBody = jsonArray.toJSONString();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String clientSecret = assignClientSecret(prop, request);
|
String clientSecret = assignClientSecret(prop, request);
|
||||||
String macBody = calculateHMAC(outboundBody, clientSecret);
|
String macBody = calculateHMAC(outboundBody, clientSecret);
|
||||||
|
|
||||||
response.addHeader("x-obp-signature-body", macBody);
|
response.addHeader("x-obp-signature-body", macBody);
|
||||||
response.addHeader("x-obp-partnercode", request.getHeader("x-obp-partnercode"));
|
response.addHeader("x-obp-partnercode", request.getHeader("x-obp-partnercode"));
|
||||||
response.addHeader("x-obp-txid", prop.getProperty(TransactionContextKeys.TRANSACTION_UUID,""));
|
response.addHeader("x-obp-txid", prop.getProperty(TransactionContextKeys.TRANSACTION_UUID,""));
|
||||||
|
|||||||
Reference in New Issue
Block a user