Merge branch 'jenkins_with_weblogic' of http://192.168.240.178:18080/eapim/elink-online-common.git into jenkins_with_weblogic

This commit is contained in:
cho
2026-01-15 15:49:15 +09:00
@@ -163,7 +163,7 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp
// 레이아웃 메시지 타입 REST URL 추출 시 활용. Default JSON
String messageType = prop.getProperty("MESSAGE_TYPE", MessageType.JSON);
String inboundMethod = tempProp.getProperty(HttpAdapterServiceKey.INBOUND_METHOD, "POST");
String inboundToken = tempProp.getProperty(HttpAdapterServiceKey.INBOUND_TOKEN, "");
//String inboundToken = tempProp.getProperty(HttpAdapterServiceKey.INBOUND_TOKEN, "");
//Outbound 요청에 대한 응답 메시지의 복호화 여부 결정위해 jwhong
encryptResponseApply = StringUtils.equalsIgnoreCase(prop.getProperty("ENCRYPT_RESPONSE_APPLY", "N"), "Y");
@@ -380,7 +380,7 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp
// assignPostBody(dataObject, contentType, vo.getEncode(), method);
//assignPostBody(dataContent, contentType, vo.getEncode(), method); // jwhong commnet
// KJBank API 추적정보를 Header에 제공. jwhong
// String inboundToken= assignRequestKJHeaders(method, prop, tempProp );
String inboundToken= assignRequestKJHeaders(method, prop, tempProp );
assignPostBody(dataContent, contentType, vo.getEncode(), method, vo.getAdapterName(), auth, inboundToken, currentDate);
break;
default:
@@ -398,9 +398,6 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp
// Adapter 레벨 header 보다 data로 넘어온 httpHeader를 우선 적용(header명이 같다면 덮어씀)
assignRequestHeaders(method, httpHeader, prop);
// KJBank API 추적정보를 Header에 제공. jwhong
//assignRequestKJHeaders(method, prop, tempProp );
int status = -1;
try {
@@ -622,6 +619,7 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp
responseMessage = jsonStr.getBytes(vo.getEncode());
}
return assignResponseHeaders(method, responseMessage, headerGroupName, vo.getEncode(), messageType,
relayResponseHeaderKeys, status, responseHeaderProp);
} catch (SocketTimeoutException ste) { // Read Timeout :: HttpClient 3.1일 경우
@@ -874,6 +872,7 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp
/*
* KJBank Target System으로 요청 보낼때 header에 clientId(업체정보), APIM거래추적자(UUID), 최초 요청시간, guid 추가해서 보낸다. jwhong
* token 만 return 하는것으로 수정함
*/
private String assignRequestKJHeaders(HttpUriRequestBase method, Properties prop, Properties tempProp){
@@ -921,51 +920,6 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp
jwtToken = authorization.substring(7); // "Bearer " 이후의 JWT만 추출
}
String headerRelay = PropManager.getInstance().getProperty("HEADER_RELAY_ADAPTER","adapter.name");
Set<String> values = new HashSet<>(Arrays.asList(headerRelay.split(",")));
String inputAdapter = tempProp.getProperty(HttpAdapterServiceKey.OUT_ADAPTER_GROUP_NAME, "");
String[] parts = inputAdapter.split("_");
String target = parts[1]; // adapter name의 앞의 3자리
String adapterName = target.substring(0, 3);
if (values.contains(adapterName)) {
/* 업체정보 */
String clientId = JwtClientIdExtractor(jwtToken);
method.setHeader("clientId", clientId);
/* APIM 거래추적자 */
String uuid = tempProp.getProperty(TransactionContextKeys.TRANSACTION_UUID, "");
method.setHeader("traceId", uuid);
/* GUID */
String guid = tempProp.getProperty(TransactionContextKeys.GUID, "");
method.setHeader("guid", guid);
/* 최초요청시간 */
String receivedTimestamp = tempProp.getProperty(HttpAdapterServiceKey.INBOUND_REQUESTED_TIME, "");
method.setHeader("receivedTimestamp", receivedTimestamp);
}
/* 업체정보 */
//String clientId = JwtClientIdExtractor(jwtToken);
//method.setHeader("clientId", clientId);
/* APIM 거래추적자 */
//String uuid = tempProp.getProperty(TransactionContextKeys.TRANSACTION_UUID, "");
//method.setHeader("traceId", uuid);
/* GUID */
//String guid = tempProp.getProperty(TransactionContextKeys.GUID, "");
//method.setHeader("guid", guid);
/* 최초요청시간 */
//String receivedTimestamp = tempProp.getProperty(HttpAdapterServiceKey.INBOUND_REQUESTED_TIME, "");
//method.setHeader("receivedTimestamp", receivedTimestamp);
return jwtToken;
}
@@ -991,7 +945,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, Date currentDate) {
private void assignPostBody(Object eaiBody, String contentType, String charset, HttpUriRequestBase method, String adapterName, String niceAuth, String inboundToken, Date currentDate) throws Exception {
if (eaiBody == null) {
return;
}
@@ -1031,7 +985,7 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp
}
// from here by jwhong
private String doOutboundPreFilter(Object eaiBody, String adapterName, String niceAuth, String inboundToken, Date currentDate) {
private String doOutboundPreFilter(Object eaiBody, String adapterName, String niceAuth, String inboundToken, Date currentDate) throws Exception {
Properties properties = AdapterPropManager.getInstance().getProperties(adapterName); // jwhong
String encryptAlgorithm = properties.getProperty("ENCRYPT_ALGORITHM",""); // jwhong
@@ -1071,7 +1025,7 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp
return responseMessage;
}
private String doOutboundPreEncrypt(Object eaiBody, String encryptAlgorithm, String clientSecretKey, String encryptAES256Iv, String encryptAES256Key, String certPath, Date currentDate) {
private String doOutboundPreEncrypt(Object eaiBody, String encryptAlgorithm, String clientSecretKey, String encryptAES256Iv, String encryptAES256Key, String certPath, Date currentDate) throws Exception {
String encryptedMessage = "";
String encryptedJsonKey = "";
@@ -1090,6 +1044,7 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp
} catch (Exception e) {
e.printStackTrace();
logger.error("HttpClientAdapterServiceRest] AES128 Encryption error=" + e.getMessage());
throw new Exception("[HttpClient5AdapterServiceRest] Pre Encrypt Error : Encrypted Error, AES128 Key Invalid");
}
break;
case "AES128-TOGETHER":
@@ -1099,6 +1054,7 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp
} catch (Exception e) {
e.printStackTrace();
logger.error("HttpClientAdapterServiceRest] AES128 Encryption error=" + e.getMessage());
throw new Exception("[HttpClient5AdapterServiceRest] Pre Encrypt Error : Encrypted Error, AES128 Key Invalid");
}
break;
case "AES256":
@@ -1108,6 +1064,7 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp
} catch (Exception e) {
e.printStackTrace();
logger.error("HttpClientAdapterServiceRest] AES256 Encryption error=" + e.getMessage());
throw new Exception("[HttpClient5AdapterServiceRest] Pre Encrypt Error : Encrypted Error, AES256 Key Invalid");
}
break;
case "AES256-KAKAO":
@@ -1116,6 +1073,7 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp
} catch (Exception e) {
e.printStackTrace();
logger.error("HttpClientAdapterServiceRest] AES256 Encryption error=" + e.getMessage());
throw new Exception("[HttpClient5AdapterServiceRest] Pre Encrypt Error : Encrypted Error, AES256 Key Invalid");
}
break;
case "AES256-TOSS":
@@ -1124,6 +1082,7 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp
} catch (Exception e) {
e.printStackTrace();
logger.error("HttpClientAdapterServiceRest] AES256 Encryption error=" + e.getMessage());
throw new Exception("[HttpClient5AdapterServiceRest] Pre Encrypt Error : Encrypted Error, AES256 Key Invalid");
}
break;
case "AES256-NICEON":
@@ -1135,6 +1094,7 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp
} catch (Exception e) {
e.printStackTrace();
logger.error("HttpClientAdapterServiceRest] AES256 Encryption error=" + e.getMessage());
throw new Exception("[HttpClient5AdapterServiceRest] Pre Encrypt Error : Encrypted Error, AES256 Key Invalid");
}
break;
case "AES256GCM":
@@ -1147,6 +1107,7 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp
} catch (Exception e) {
e.printStackTrace();
logger.error("HttpClientAdapterServiceRest] AES256GCM Encryption error=" + e.getMessage());
throw new Exception("[HttpClient5AdapterServiceRest] Pre Encrypt Error : Encrypted Error, AES256GCM Key Invalid");
}
break;
case "ECDHESA256":
@@ -1168,6 +1129,7 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp
} catch (Exception e) {
e.printStackTrace();
logger.error("HttpClientAdapterServiceRest] AES256GCM Encryption error=" + e.getMessage());
throw new Exception("[HttpClient5AdapterServiceRest] Pre Encrypt Error : Encrypted Error, ECDHESA256 Key Invalid");
}
break;
default: