From 459890380333a7aeffd9e23df76605fce628122d Mon Sep 17 00:00:00 2001 From: pksup Date: Thu, 18 Dec 2025 15:58:28 +0900 Subject: [PATCH 1/5] =?UTF-8?q?error=20message=20format=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20-=20OAuth2=20RFC=206749=2022a2a0fd2268cdc2635dfcda5?= =?UTF-8?q?c407756a799316b?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/eactive/eai/common/util/MessageUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/eactive/eai/common/util/MessageUtil.java b/src/main/java/com/eactive/eai/common/util/MessageUtil.java index 4304ff1..6ff58b1 100644 --- a/src/main/java/com/eactive/eai/common/util/MessageUtil.java +++ b/src/main/java/com/eactive/eai/common/util/MessageUtil.java @@ -34,7 +34,7 @@ import com.solab.iso8583.IsoMessage; public final class MessageUtil { static Logger logger = LoggerFactory.getLogger(MessageUtil.class); - public static final String ERROR_MESSAGE_DEFAULT_FORMAT = "{\"error\":{\"code\":\"%s\",\"message\":\"%s\"}}"; + public static final String ERROR_MESSAGE_DEFAULT_FORMAT = "{\"error\":\"%s\",\"error_description\":\"%s\"}"; public static final String ERROR_CODE_AP_ERROR = "E.GW.AP_ERROR"; public static final String ERROR_CODE_AUTH_FAIL = "E.GW.AUTH_FAIL"; From 445117c4fb245824fc965cd5b3e875da0ab0e012 Mon Sep 17 00:00:00 2001 From: yunjy-hp Date: Thu, 18 Dec 2025 17:28:18 +0900 Subject: [PATCH 2/5] =?UTF-8?q?=EC=84=9C=ED=82=B7=20=EB=B8=8C=EB=A0=88?= =?UTF-8?q?=EC=9D=B4=EC=BB=A4=20SMS=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/eactive/eai/outbound/RESTProcess.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/eactive/eai/outbound/RESTProcess.java b/src/main/java/com/eactive/eai/outbound/RESTProcess.java index bc4f0cf..47db22c 100644 --- a/src/main/java/com/eactive/eai/outbound/RESTProcess.java +++ b/src/main/java/com/eactive/eai/outbound/RESTProcess.java @@ -5,12 +5,14 @@ import java.util.Properties; import com.eactive.eai.common.TransactionContextKeys; import com.eactive.eai.common.circuitBreaker.CircuitBreakerManager; +import com.eactive.eai.common.util.SMSLogUtil; import com.eactive.eai.message.StandardMessage; import com.eactive.eai.util.PropertiesUtil; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; import com.initech.core.util.PropertiesManager; +import io.github.resilience4j.circuitbreaker.CallNotPermittedException; import io.github.resilience4j.circuitbreaker.CircuitBreaker; import org.apache.commons.lang3.StringUtils; @@ -105,7 +107,12 @@ public class RESTProcess extends HTTPProcess { combinedNode.set("metrics", objectMapper.valueToTree(circuitBreaker.getMetrics())); logger.info("CircuitBreaker state "+combinedNode.toString()); - this.resObject = circuitBreaker.executeCallable(() -> HttpSender.callService(this.adapterGroupName, this.outboundProp, this.reqObject, this.tempProp)); + try { + this.resObject = circuitBreaker.executeCallable(() -> HttpSender.callService(this.adapterGroupName, this.outboundProp, this.reqObject, this.tempProp)); + }catch(CallNotPermittedException callNotPermittedException){ + SMSLogUtil.loggingSMS(reqEaiMsg.getEAISvcCd(), "CIRCUIT_IS_OPEN!"); + throw callNotPermittedException; + } }else{ this.resObject = HttpSender.callService(this.adapterGroupName, this.outboundProp, this.reqObject, this.tempProp); } From 0aa9dbee6f93799ad1bcae8e97844dff91304c9f Mon Sep 17 00:00:00 2001 From: jaewohong Date: Fri, 19 Dec 2025 10:49:58 +0900 Subject: [PATCH 3/5] =?UTF-8?q?NiceOn=20=EC=97=85=EB=AC=B4=EC=9A=94?= =?UTF-8?q?=EC=B2=AD=EC=8B=9C=20header=20=EC=88=98=EC=A0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../http/client/impl/HttpClient5AdapterServiceRest.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 50eb1f9..48a27bd 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 @@ -92,6 +92,7 @@ import com.kjbank.encrypt.exchange.crypto.ECDHESA256Cipher; import com.eactive.eai.authserver.service.OAuth2Manager; import java.util.Set; import java.util.HashSet; +import java.util.Date; /** * 1. 기능 : EAI HTTP OutBound 용 어댑터로 수동 시스템의 HTTP 웹 컴포넌트를 GET/POST 방식으로 호출할 수 있는 @@ -326,7 +327,8 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp throw new Exception("NiceOn Token is empty, TOKEN failed to be issued, TOKEN = [" + niceToken + "]"); } String clientId = accessToken.getClientId(); // HttpClientAccessTokenServiceWithBase64NiceOn 서 넣어줌 - long currentTime = System.currentTimeMillis(); + Date currentDate = new Date(); + long currentTime = currentDate.getTime() / 1000; auth = niceToken + ":" + currentTime + ":" + clientId ; logger.debug("HttpClientAdapterServiceRest] NiceOn auth = [" + auth + "]"); auth = Base64.getEncoder().encodeToString(auth.getBytes("UTF-8")); @@ -339,7 +341,7 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp if (logger.isDebug()) { logger.debug("HttpClientAdapterServiceRest] SEND (" + vo.getAdapterGroupName() - + ") RequestHeader [Authorization=" + method.getHeader("Authorization") + "]"); + + ") RequestHeader [" + method.getHeader("Authorization").getName() + ": " + method.getHeader("Authorization").getValue() + "]"); } } From 409dafa4753f60afa9ab7dcd6a7a71e5374a106a Mon Sep 17 00:00:00 2001 From: jaewohong Date: Fri, 19 Dec 2025 16:19:35 +0900 Subject: [PATCH 4/5] =?UTF-8?q?NiceOn=20=EC=97=85=EB=AC=B4=EC=9A=94?= =?UTF-8?q?=EC=B2=AD=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/HttpClient5AdapterServiceRest.java | 32 +++++++++++++++---- 1 file changed, 25 insertions(+), 7 deletions(-) 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 48a27bd..5e49e25 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 @@ -7,6 +7,7 @@ import java.net.ConnectException; import java.net.SocketTimeoutException; import java.net.URI; import java.nio.charset.StandardCharsets; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -729,7 +730,8 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp private void setNiceOnAuthHeaders(HttpUriRequestBase method, String auth) throws Exception { method.setHeader("Authorization", String.format("%s %s", AccessTokenVO.BEARER_TYPE, auth)); // 나이스지키미 format임 - method.setHeader("ProductID", "2303345072"); + String productId = PropManager.getInstance().getProperty("NiceOnProperty","productId.value"); + method.setHeader("ProductID", productId); //method.setHeader("Authorization", // String.format("%s %s", AccessTokenVO.BEARER_TYPE, accessToken.getAccessToken())); } @@ -1101,11 +1103,27 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp //break; } - Map map = new HashMap<>(); - map.put(encryptedJsonKey, encryptedMessage); - JSONObject json = new JSONObject(); - json.putAll(map); - return json.toJSONString(); + if (encryptAlgorithm.equals("AES256-NICEON")) { + 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("goods_cls", goodsCls); + map.put(encryptedJsonKey, encryptedMessage); + JSONObject dataBody = new JSONObject(); + dataBody.putAll(map); + + JSONObject json = new JSONObject(); + json.put("dataBody", dataBody); + return json.toJSONString(); + } else { + Map map = new HashMap<>(); + map.put(encryptedJsonKey, encryptedMessage); + JSONObject json = new JSONObject(); + json.putAll(map); + return json.toJSONString(); + } + //return encryptedMessage; } @@ -1303,7 +1321,7 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp jsonKey = "encryptedData"; break; case "AES256-NICEON": - jsonKey = "preScreeningRequest"; + jsonKey = "enc_data"; break; case "AES256GCM": break; From 0792c481290d9d392355d7a5063e74f28dcec5e2 Mon Sep 17 00:00:00 2001 From: jaewohong Date: Fri, 19 Dec 2025 17:52:38 +0900 Subject: [PATCH 5/5] =?UTF-8?q?niceon=20currentdata=20=EA=B4=80=EB=A0=A8?= =?UTF-8?q?=20=EC=88=98=EC=A0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/HttpClient5AdapterServiceRest.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) 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();