diff --git a/WebContent/META-INF/context.xml b/WebContent/META-INF/context.xml
index 2df0867..385912e 100644
--- a/WebContent/META-INF/context.xml
+++ b/WebContent/META-INF/context.xml
@@ -25,10 +25,38 @@
-
+ -->
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/WebContent/WEB-INF/properties/env.D.properties b/WebContent/WEB-INF/properties/env.D.properties
index c69e742..f73d61a 100644
--- a/WebContent/WEB-INF/properties/env.D.properties
+++ b/WebContent/WEB-INF/properties/env.D.properties
@@ -2,20 +2,22 @@
# Examples
# - H2 : org.hibernate.dialect.H2Dialect
# - oracle10g : org.hibernate.dialect.Oracle10gDialect
+# - oracle12c : org.hibernate.dialect.Oracle12cDialect
+# - MySQL5 : org.hibernate.dialect.MySQL5Dialect
# - MySQL8 : org.hibernate.dialect.MySQL8Dialect
# - MariaDB 10.3 : org.hibernate.dialect.MariaDB103Dialect
-hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
+hibernate.dialect=org.hibernate.dialect.Oracle12cDialect
# eLink default functions
# set System property in real system
#inst.Name=${HOSTNAME}
-inst.Name=elinkSvr11
-eai.jdbc.Name=NDAPIGW_APP_NXA
-eai.rmiport=10211
-eai.rmiserviceport=10212
+inst.Name=agwSvr11
+eai.jdbc.Name=jdbc/dsOBP_AGW
+eai.rmiport=30111
+eai.rmiserviceport=30112
eai.systemmode=D
# EAI FEP MCI GW ...
eai.systemtype=API
-eai.tableowner=ndapigw
+eai.tableowner=AGWADM
eai.server.extractor=[0,2],[0,2],[-2]
diff --git a/WebContent/WEB-INF/properties/env.common.properties b/WebContent/WEB-INF/properties/env.common.properties
index 1341574..9122d87 100644
--- a/WebContent/WEB-INF/properties/env.common.properties
+++ b/WebContent/WEB-INF/properties/env.common.properties
@@ -18,7 +18,9 @@ shutdown.wait.intervalms=1000
# message function
# use default options
# async queue
-use.internal.queue=true
+// below false to test Weblogic JMS, jwhong
+#use.internal.queue=true
+use.internal.queue=false
# sync-async mapping
use.internal.topic=true
# restore mapping
diff --git a/WebContent/WEB-INF/web.xml b/WebContent/WEB-INF/web.xml
index 3e0192a..6661aad 100644
--- a/WebContent/WEB-INF/web.xml
+++ b/WebContent/WEB-INF/web.xml
@@ -34,7 +34,18 @@
contextConfigLocation
/WEB-INF/applicationContext.xml
-
+
+
+
authserver
@@ -60,17 +71,17 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+ RestApiDynamicInAdapter
+ com.eactive.eai.adapter.http.dynamic.RestApiAdapterMain
+ 2
+
+
+ RestApiDynamicInAdapter
+ /API/*
+ /api/*
+
+<%@ page language="java" contentType="text/html;charset=utf-8"%>
+
+
+ Gateway 관리메뉴
+
+
+ <%
+ String display = null;
+ try{
+ com.eactive.kakao.rolling.TableSuffixResolver service = com.eactive.eai.common.util.ApplicationContextProvider.getContext().getBean(com.eactive.kakao.rolling.TableSuffixResolver.class);
+ com.eactive.kakao.rolling.CurrentCommitIdService currentCommitIdService = com.eactive.eai.common.util.ApplicationContextProvider.getContext().getBean(com.eactive.kakao.rolling.CurrentCommitIdService.class);
+ String currentCommitId = currentCommitIdService.getSystemCommitId();
+ String currentSuffix = service.getCurrentSuffix();
+ if (currentCommitId != null && currentSuffix != null){
+ display = "rolling [ currentCommitId=" + currentCommitId + ", currentSuffix=" + currentSuffix +" ]" ;
+ }
+ }catch(Exception e){
+
+ }
+ %>
+ POD[<%=System.getProperty("inst.Name")%>] IP[<%=request.getLocalAddr()%>] Hostname[<%=java.net.InetAddress.getLocalHost().getHostName()%>] <%=display != null ? display : "" %>
+
+ 오류메시지 관리
+
+ 어댑터 관리
+
+ 프라퍼티 관리
+
+ 로그조회키 관리
+ 메시지 키 관리
+
+ 내부표준메시지 관리
+
+ EAI 서비스 코드 관리
+
+ 라우팅 필드추출 정보
+ 라우팅 B2B기관 정보
+ 라우팅 특정포트 매핑
+
+ EAI 서버 관리
+ Routing 관리
+
+ TestCall 상태 관리
+ LifeCycle List
+
+
+
+
+
+ 어댑터 유량제어 정보
+ 인터페이스 유량제어 정보
+
+
+
diff --git a/build.gradle b/build.gradle
index eb7396e..50e4c78 100644
--- a/build.gradle
+++ b/build.gradle
@@ -8,7 +8,7 @@ plugins {
}
group 'com.eactvie'
-version '4.5.7'
+//version '4.5.7'
def springVersion = "5.3.27"
//def springSecurityVersion = '4.2.13.RELEASE'
@@ -46,8 +46,6 @@ compileJava {
}
war {
- archiveFileName = "eapim-online.war"
-
exclude '**/persistence.xml'
exclude '**/context.xml'
}
diff --git a/src/main/java/com/eactive/eai/adapter/service/ApiAdapterService.java b/src/main/java/com/eactive/eai/adapter/service/ApiAdapterService.java
index ddc536c..77b80b4 100644
--- a/src/main/java/com/eactive/eai/adapter/service/ApiAdapterService.java
+++ b/src/main/java/com/eactive/eai/adapter/service/ApiAdapterService.java
@@ -36,6 +36,18 @@ import javax.servlet.http.HttpServletResponse;
import java.net.URLDecoder;
import java.util.*;
+//for encrypt/decrypt jwhong
+import com.eactive.eai.authserver.service.OAuth2Manager;
+import com.kjbank.encrypt.exchange.crypto.AES256Cipher;
+import com.kjbank.encrypt.exchange.crypto.AESCipher;
+import java.nio.charset.StandardCharsets;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import org.springframework.security.oauth2.provider.ClientDetails;
+
@Service
public class ApiAdapterService extends HttpAdapterServiceSupport {
static Logger logger = Logger.getLogger(Logger.LOGGER_ADAPTER);
@@ -49,7 +61,7 @@ public class ApiAdapterService extends HttpAdapterServiceSupport {
private static final String JSON_FIELD_NAME = "json-body";
private static final String FILE_GROUP_NAME = "image-file";
private static final String UPLOAD_ROOT_PATH = "UPLOAD_ROOT_PATH";
-
+
public String callApi(HttpServletRequest request, HttpServletResponse response, Properties httpProp, AdapterGroupVO adapterGroupVO, AdapterVO adapterVO, Properties transactionProp) throws Exception {
int traceLevel = 0;
@@ -70,7 +82,7 @@ public class ApiAdapterService extends HttpAdapterServiceSupport {
String paramValue = null;
String adptMsgType = null;
-
+
transactionProp.put(INBOUND_METHOD, request.getMethod());
transactionProp.put(INBOUND_URI, request.getRequestURI());
transactionProp.put(INBOUND_HEADER, getHeaders(request));
@@ -80,7 +92,7 @@ public class ApiAdapterService extends HttpAdapterServiceSupport {
String extUrl = StringUtils.removeStart(request.getRequestURI(), request.getContextPath());
transactionProp.put(INBOUND_EXTURI, extUrl);
} else {
- transactionProp.put(INBOUND_EXTURI, getExtUri(request));
+ transactionProp.put(INBOUND_EXTURI, getExtUri(request));
}
transactionProp.put(INBOUND_CLIENT_IP, getClientIp(request)); // Client IP 추가
transactionProp.put(Processor.REQUEST_ACTION, adapterVO.getAdapterGroupVO().getRefClass());
@@ -92,6 +104,13 @@ public class ApiAdapterService extends HttpAdapterServiceSupport {
transactionProp.put(ENC_PATHS, httpProp.getProperty(ENC_PATHS, ""));
+ transactionProp.put(ENCRYPT_ALGORITHM, httpProp.getProperty(ENCRYPT_ALGORITHM, "")); //jwhong
+ transactionProp.put(HEADER_NAME_CLIENT_ID, getHeaders(request).get(HEADER_NAME_CLIENT_ID)); // jwhong
+ transactionProp.put(ENCRYPT_BASE_TYPE, httpProp.getProperty(ENCRYPT_BASE_TYPE, "")); //jwhong
+ //transactionProp.put(INBOUND_TOKEN, getHeaders(request).get(INBOUND_TOKEN)); // jwhong
+ transactionProp.put(INBOUND_TOKEN, getHeaders(request).get(INBOUND_TOKEN) != null ? getHeaders(request).get(INBOUND_TOKEN) : ""); //jwhong , null 이면 default로 "" put
+
+
try {
traceLevel = Integer.parseInt(traceLevelTemp);
} catch (Exception e) {
@@ -197,6 +216,9 @@ public class ApiAdapterService extends HttpAdapterServiceSupport {
if (paramValue == null) { // parameter가 없는 경우때문에 처리
paramValue = "";
+ }
+ else { // jwhong decrypt
+ paramValue = doPreDecryption(paramValue, transactionProp);
}
if ("Y".equals(urlDecodeYn) && isParameterType) {
@@ -279,6 +301,129 @@ public class ApiAdapterService extends HttpAdapterServiceSupport {
return result;
}
+
+
+ // jwhong encrypt
+
+ private String doPreDecryption(String eaiBody, Properties transactionProp) {
+ String decryptAlgorithm = transactionProp.getProperty(ENCRYPT_ALGORITHM, "");
+ String xElinkClientId = transactionProp.getProperty(HEADER_NAME_CLIENT_ID, ""); // 이 값이 OAuth의 client id 값이다 . http header 에 포함되어 온다. jwhong
+ String encryptBaseKeyType = transactionProp.getProperty(ENCRYPT_BASE_TYPE);
+ String inboundToken = transactionProp.getProperty(INBOUND_TOKEN, "");
+
+ if ( decryptAlgorithm == "" ) { // 복호화 대상이 아님
+ return eaiBody;
+ }
+
+ // 암호화 key를 token 내용으로 할지 client secret 내용으로 할지 결정함. adapter property에 정의함
+ // ENCRYPT_ALGORITHM 을 설정했는데 ENCRYPT_BASE_TYPE을 설정안하면 Decrypt 수행시 Exception 발생함
+ String clientSecret = "";
+ if ("TOKEN".equalsIgnoreCase(encryptBaseKeyType)) {
+ clientSecret = inboundToken;
+ } else if ( "SECRETKEY".equalsIgnoreCase(encryptBaseKeyType)) {
+ OAuth2Manager manager = OAuth2Manager.getInstance();
+ ClientDetails clientDetail = manager.getClientDeatilsStore().get(xElinkClientId);
+
+ if ( clientDetail != null ) {
+ clientSecret = clientDetail.getClientSecret();
+ }
+ }
+
+ byte[] decryptedMessage = null;
+ decryptedMessage = doInboundPreDecrypt(eaiBody, decryptAlgorithm,clientSecret);
+
+ String resultMessage = new String(decryptedMessage, StandardCharsets.UTF_8 );
+ return resultMessage;
+ //return new String(decryptedMessage, StandardCharsets.UTF_8 );
+ }
+
+
+ private byte[] convertObjectToBytes(Object obj) throws IOException {
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(bos);
+ oos.writeObject(obj);
+ oos.flush();
+ return bos.toByteArray();
+ }
+
+ private byte[] convertObjectToBase64Bytes(Object obj) throws IOException {
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(bos);
+ oos.writeObject(obj);
+ oos.flush();
+ oos.close();
+
+ // 직렬화된 byte[] → Base64 문자열 → 다시 byte[]로 변환
+ String base64String = Base64.getEncoder().encodeToString(bos.toByteArray());
+ return base64String.getBytes(StandardCharsets.UTF_8);
+ }
+
+ public static Object convertBytesToObject(byte[] bytes) throws IOException, ClassNotFoundException {
+ try (ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
+ ObjectInputStream ois = new ObjectInputStream(bis)) {
+ return ois.readObject();
+ }
+ }
+
+
+ private byte[] doInboundPreDecrypt(String eaiStringBody, String decryptAlgorithm, String clientSecretKey) {
+
+ byte[] decryptedMessage = null;
+ //String eaiStringBody = new String(eaiBody, StandardCharsets.UTF_8);
+
+ //test source
+ //System.out.println("eaiBody 바이트 배열 길이: " + eaiBody.length);
+ System.out.println("Base64 문자열: " + eaiStringBody);
+ System.out.println("Base64 문자열 길이: " + eaiStringBody.length());
+ System.out.println("Base64 문자열 끝: " + eaiStringBody.substring(eaiStringBody.length() - 10));
+
+ // Base64 디코딩 테스트
+ try {
+ byte[] decoded = Base64.getDecoder().decode(eaiStringBody);
+ System.out.println("디코딩 성공, 길이: " + decoded.length);
+ } catch (IllegalArgumentException e) {
+ System.out.println("Base64 디코딩 실패: " + e.getMessage());
+ }
+ // end test source
+
+ switch (decryptAlgorithm) {
+ case "AES128":
+
+ String key128 = clientSecretKey.substring(22,38); //togetherEncoder 경우는 substring(44,60) 이네??
+ try {
+ //String decryptedStrMessage = AESCipher.decrypt(eaiStringBody, key128);
+ String decryptedStrMessage = AESCipher.decryptExistException(eaiStringBody, key128);
+ decryptedMessage = decryptedStrMessage.getBytes(StandardCharsets.UTF_8);
+ } catch (Exception e) {
+ e.printStackTrace();
+ logger.error("HttpClientAdapterServiceRest] AES128 Decryption error=" + e.getMessage());
+ }
+ break;
+ case "AES256":
+ String key = clientSecretKey.substring(10,42);
+ try {
+ String decryptedStrMessage = AES256Cipher.decrypt(eaiStringBody, key);
+ decryptedMessage = decryptedStrMessage.getBytes(StandardCharsets.UTF_8);
+ } catch (Exception e) {
+ e.printStackTrace();
+ logger.error("HttpClientAdapterServiceRest] AES256 Decryption error=" + e.getMessage());
+ }
+ break;
+ default:
+ try {
+ //decryptedMessage = Arrays.copyOf(eaiBody, eaiBody.length);
+ decryptedMessage = eaiStringBody.getBytes();
+ } catch (Exception e) {
+ e.printStackTrace();
+ logger.error("HttpClientAdapterServiceRest] doOutboundPostFilter Array copy error=" + e.getMessage());
+ }
+ break;
+ }
+
+ return decryptedMessage;
+ }
+
+ // jwhong until here
private Map assignParameterMap(HttpServletRequest request, String adptGrpName, String adptName,