Outbound Filter 적용을 위한 수정

This commit is contained in:
Yunsam.Eo
2025-12-21 16:24:17 +09:00
parent 204953227c
commit 6d75f1870f
3 changed files with 27 additions and 2 deletions
@@ -91,6 +91,7 @@ import com.kjbank.encrypt.exchange.crypto.AES256GCMCipher;
import com.kjbank.encrypt.exchange.crypto.ECDHESA256Cipher; import com.kjbank.encrypt.exchange.crypto.ECDHESA256Cipher;
import com.eactive.eai.authserver.service.OAuth2Manager; import com.eactive.eai.authserver.service.OAuth2Manager;
import java.util.Set; import java.util.Set;
import java.util.Map.Entry;
import java.util.HashSet; import java.util.HashSet;
/** /**
@@ -165,6 +166,7 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp
// 레이아웃 메시지 타입 REST URL 추출 시 활용. Default JSON // 레이아웃 메시지 타입 REST URL 추출 시 활용. Default JSON
String messageType = prop.getProperty("MESSAGE_TYPE", MessageType.JSON); String messageType = prop.getProperty("MESSAGE_TYPE", MessageType.JSON);
String inboundMethod = tempProp.getProperty(HttpAdapterServiceKey.INBOUND_METHOD, "POST"); String inboundMethod = tempProp.getProperty(HttpAdapterServiceKey.INBOUND_METHOD, "POST");
String inboundToken = tempProp.getProperty(HttpAdapterServiceKey.INBOUND_TOKEN, "");
//Outbound 요청에 대한 응답 메시지의 복호화 여부 결정위해 jwhong //Outbound 요청에 대한 응답 메시지의 복호화 여부 결정위해 jwhong
encryptResponseApply = StringUtils.equalsIgnoreCase(prop.getProperty("ENCRYPT_RESPONSE_APPLY", "N"), "Y"); encryptResponseApply = StringUtils.equalsIgnoreCase(prop.getProperty("ENCRYPT_RESPONSE_APPLY", "N"), "Y");
@@ -349,6 +351,7 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp
// 여기 까지 // 여기 까지
configureHttpClient(requestConfigBuilder, vo, method); configureHttpClient(requestConfigBuilder, vo, method);
assignFilterHeaders(method, tempProp); // OutBound PreFilter에서 설정한 Header내용 설정.
switch (HttpMethodType.getValue(rmethod)) { switch (HttpMethodType.getValue(rmethod)) {
case GET: case GET:
@@ -373,7 +376,7 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp
// assignPostBody(dataObject, contentType, vo.getEncode(), method); // assignPostBody(dataObject, contentType, vo.getEncode(), method);
//assignPostBody(dataContent, contentType, vo.getEncode(), method); // jwhong commnet //assignPostBody(dataContent, contentType, vo.getEncode(), method); // jwhong commnet
// KJBank API 추적정보를 Header에 제공. jwhong // KJBank API 추적정보를 Header에 제공. jwhong
String inboundToken= assignRequestKJHeaders(method, prop, tempProp ); // String inboundToken= assignRequestKJHeaders(method, prop, tempProp ); Filter에서 처리함.
assignPostBody(dataContent, contentType, vo.getEncode(), method, vo.getAdapterName(), auth, inboundToken); assignPostBody(dataContent, contentType, vo.getEncode(), method, vo.getAdapterName(), auth, inboundToken);
break; break;
default: default:
@@ -804,6 +807,25 @@ public class HttpClient5AdapterServiceRest extends HttpClient5AdapterServiceSupp
} }
} }
} }
private void assignFilterHeaders(HttpUriRequestBase method, Properties tempProp) {
try {
Properties filterHeaders = (Properties)tempProp.get("FILTERHEADER");
if (filterHeaders != null){
for (Entry<Object, Object> e : filterHeaders.entrySet()) {
String key = (String) e.getKey();
String value = (String) e.getValue();
method.setHeader(key, value);
if (logger.isDebugEnabled()) {
logger.debug("OutBound Filter] Request Header :" + key + "=[" + value + "]");
}
}
}
} catch (Exception e) {
logger.error(e.getMessage());
}
}
/* /*
* KJBank Target System으로 요청 보낼때 header에 clientId(업체정보), APIM거래추적자(UUID), 최초 요청시간, guid 추가해서 보낸다. jwhong * KJBank Target System으로 요청 보낼때 header에 clientId(업체정보), APIM거래추적자(UUID), 최초 요청시간, guid 추가해서 보낸다. jwhong
@@ -73,7 +73,7 @@ public interface HttpAdapterServiceKey {
static final String ENC_PATHS = "ENC_PATHS"; static final String ENC_PATHS = "ENC_PATHS";
static final String ENCRYPT_ALGORITHM = "ENCRYPT_ALGORITHM"; //jwhong static final String ENCRYPT_ALGORITHM = "ENCRYPT_ALGORITHM"; //jwhong
static final String INBOUND_TOKEN = "authorization"; // jwhong static final String INBOUND_TOKEN = "AUTHORIZATION"; // jwhong
static final String ENCRYPT_BASE_TYPE = "ENCRYPT_BASE_TYPE"; // jwhong static final String ENCRYPT_BASE_TYPE = "ENCRYPT_BASE_TYPE"; // jwhong
static final String ENCRYPT_AES256_IV = "ENCRYPT_AES256_IV"; // jwhong static final String ENCRYPT_AES256_IV = "ENCRYPT_AES256_IV"; // jwhong
static final String ENCRYPT_AES256_KEY = "ENCRYPT_AES256_KEY"; // jwhong static final String ENCRYPT_AES256_KEY = "ENCRYPT_AES256_KEY"; // jwhong
@@ -21,6 +21,7 @@ import com.eactive.eai.adapter.AdapterVO;
import com.eactive.eai.adapter.http.HttpStatusException; import com.eactive.eai.adapter.http.HttpStatusException;
import com.eactive.eai.adapter.http.client.HttpClientAdapterServiceKey; import com.eactive.eai.adapter.http.client.HttpClientAdapterServiceKey;
import com.eactive.eai.adapter.http.dynamic.HttpAdapterServiceKey; import com.eactive.eai.adapter.http.dynamic.HttpAdapterServiceKey;
import com.eactive.eai.adapter.http.dynamic.HttpAdapterServiceSupport;
import com.eactive.eai.common.EAIKeys; import com.eactive.eai.common.EAIKeys;
import com.eactive.eai.common.exception.ExceptionUtil; import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.header.HeaderAction; import com.eactive.eai.common.header.HeaderAction;
@@ -441,6 +442,8 @@ public class RESTProcess extends HTTPProcess {
PropertiesUtil.copyPropertyIfPresent(this.callProp, this.tempProp, HttpAdapterServiceKey.INBOUND_SCHEME); PropertiesUtil.copyPropertyIfPresent(this.callProp, this.tempProp, HttpAdapterServiceKey.INBOUND_SCHEME);
PropertiesUtil.copyPropertyIfPresent(this.callProp, this.tempProp, HttpAdapterServiceKey.INBOUND_REQUESTED_TIME); // jwhong PropertiesUtil.copyPropertyIfPresent(this.callProp, this.tempProp, HttpAdapterServiceKey.INBOUND_REQUESTED_TIME); // jwhong
PropertiesUtil.copyPropertyIfPresent(this.callProp, this.tempProp, HttpAdapterServiceKey.GUID); // jwhong PropertiesUtil.copyPropertyIfPresent(this.callProp, this.tempProp, HttpAdapterServiceKey.GUID); // jwhong
PropertiesUtil.copyPropertyIfPresent(this.callProp, this.tempProp, HttpAdapterServiceKey.INBOUND_TOKEN); // jwhong
PropertiesUtil.copyPropertyIfPresent(this.callProp, this.tempProp, HttpAdapterServiceSupport.PROPERTIES_NAME_CLIENT_ID); // jwhong
String svcName = getServiceId(this.reqEaiMsg); String svcName = getServiceId(this.reqEaiMsg);
if (svcName == null) { if (svcName == null) {