diff --git a/src/main/java/com/eactive/eai/adapter/http/client/impl/HttpClient5AdapterServiceRest.java b/src/main/java/com/eactive/eai/adapter/http/client/impl/HttpClient5AdapterServiceRest.java index 5e49e25..337ee9c 100644 --- a/src/main/java/com/eactive/eai/adapter/http/client/impl/HttpClient5AdapterServiceRest.java +++ b/src/main/java/com/eactive/eai/adapter/http/client/impl/HttpClient5AdapterServiceRest.java @@ -303,6 +303,7 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp // OAuth2AccessToken check 부분을 뒤에서 여기로 위치를 옮김, 나이스지키미 암호화 KEY를 얻기 위해서. JWHONG OAuth2AccessTokenVO accessToken = null; String auth =""; + Date currentDate = new Date(); if (useAdapterToken) { AccessTokenManagerByDB tokenManager = AccessTokenManagerByDB.getInstance(); accessToken = (OAuth2AccessTokenVO) tokenManager.getAccessTokenVO(vo.getAdapterGroupName()); @@ -327,8 +328,7 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp if ( niceToken == null || niceToken == "") { throw new Exception("NiceOn Token is empty, TOKEN failed to be issued, TOKEN = [" + niceToken + "]"); } - String clientId = accessToken.getClientId(); // HttpClientAccessTokenServiceWithBase64NiceOn 서 넣어줌 - Date currentDate = new Date(); + String clientId = accessToken.getClientId(); // HttpClientAccessTokenServiceWithBase64NiceOn 서 넣어줌 long currentTime = currentDate.getTime() / 1000; auth = niceToken + ":" + currentTime + ":" + clientId ; logger.debug("HttpClientAdapterServiceRest] NiceOn auth = [" + auth + "]"); @@ -377,7 +377,7 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp //assignPostBody(dataContent, contentType, vo.getEncode(), method); // jwhong commnet // KJBank API 추적정보를 Header에 제공. jwhong String inboundToken= assignRequestKJHeaders(method, prop, tempProp ); - assignPostBody(dataContent, contentType, vo.getEncode(), method, vo.getAdapterName(), auth, inboundToken); + assignPostBody(dataContent, contentType, vo.getEncode(), method, vo.getAdapterName(), auth, inboundToken, currentDate); break; default: break; @@ -928,7 +928,7 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp } @SuppressWarnings("deprecation") - private void assignPostBody(Object eaiBody, String contentType, String charset, HttpUriRequestBase method, String adapterName, String niceAuth, String inboundToken) { + private void assignPostBody(Object eaiBody, String contentType, String charset, HttpUriRequestBase method, String adapterName, String niceAuth, String inboundToken, Date currentDate) { if (eaiBody == null) { return; } @@ -949,7 +949,7 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp } else { ContentType contentTypeObj = ContentType.create(contentType, charset); - String eaiBodyMessage = doOutboundPreFilter(eaiBody, adapterName, niceAuth, inboundToken); // jwhong + String eaiBodyMessage = doOutboundPreFilter(eaiBody, adapterName, niceAuth, inboundToken, currentDate); // jwhong StringEntity entity = new StringEntity(eaiBodyMessage, contentTypeObj); // 요청 본문을 StringEntity 객체로 생성 //StringEntity entity = new StringEntity(eaiBody.toString(), contentTypeObj); @@ -960,7 +960,7 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp } // from here by jwhong - private String doOutboundPreFilter(Object eaiBody, String adapterName, String niceAuth, String inboundToken) { + private String doOutboundPreFilter(Object eaiBody, String adapterName, String niceAuth, String inboundToken, Date currentDate) { Properties properties = AdapterPropManager.getInstance().getProperties(adapterName); // jwhong String encryptAlgorithm = properties.getProperty("ENCRYPT_ALGORITHM",""); // jwhong @@ -995,12 +995,12 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp // 여기서 SECRETY인지 nice-auth 인지 check 하여 clientSecret 값을 정하는 logic 추가하여 넘겨야한다. - String responseMessage = doOutboundPreEncrypt(eaiBody, encryptAlgorithm, clientSecret, encryptAES256Iv, encryptAES256Key, certPath); + String responseMessage = doOutboundPreEncrypt(eaiBody, encryptAlgorithm, clientSecret, encryptAES256Iv, encryptAES256Key, certPath, currentDate); logger.debug("outbound pre encrypte value is :"+responseMessage); return responseMessage; } - private String doOutboundPreEncrypt(Object eaiBody, String encryptAlgorithm, String clientSecretKey, String encryptAES256Iv, String encryptAES256Key, String certPath ) { + private String doOutboundPreEncrypt(Object eaiBody, String encryptAlgorithm, String clientSecretKey, String encryptAES256Iv, String encryptAES256Key, String certPath, Date currentDate ) { String encryptedMessage = ""; String encryptedJsonKey = ""; @@ -1107,7 +1107,7 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp String goodsCls = PropManager.getInstance().getProperty("NiceOnProperty","goods.cls.value"); Map map = new HashMap<>(); SimpleDateFormat sdfDateTime =new SimpleDateFormat("yyyyMMddHHmmss"); - map.put("req_dtm", sdfDateTime); + map.put("req_dtm", sdfDateTime.format(currentDate)); map.put("goods_cls", goodsCls); map.put(encryptedJsonKey, encryptedMessage); JSONObject dataBody = new JSONObject();