Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9d04435f13 | |||
| 4a7669d4c0 |
Vendored
+7
-5
@@ -1,6 +1,10 @@
|
|||||||
pipeline {
|
pipeline {
|
||||||
agent { label 'djb-vm' }
|
agent { label 'djb-vm' }
|
||||||
|
|
||||||
|
triggers {
|
||||||
|
pollSCM('H/10 * * * *')
|
||||||
|
}
|
||||||
|
|
||||||
options {
|
options {
|
||||||
timestamps()
|
timestamps()
|
||||||
disableConcurrentBuilds()
|
disableConcurrentBuilds()
|
||||||
@@ -68,11 +72,10 @@ pipeline {
|
|||||||
sh '''
|
sh '''
|
||||||
set -eu
|
set -eu
|
||||||
cd build/libs
|
cd build/libs
|
||||||
sha1sum eapim-online.war > eapim-online.war.sha1
|
sha1sum eapim-online.war > SHA1SUMS
|
||||||
sha256sum eapim-online.war > eapim-online.war.sha256
|
sha256sum eapim-online.war > SHA256SUMS
|
||||||
md5sum eapim-online.war > eapim-online.war.md5
|
|
||||||
'''
|
'''
|
||||||
archiveArtifacts artifacts: 'build/libs/eapim-online.war,build/libs/eapim-online.war.sha1,build/libs/eapim-online.war.sha256,build/libs/eapim-online.war.md5', fingerprint: true
|
archiveArtifacts artifacts: 'build/libs/eapim-online.war,build/libs/SHA1SUMS,build/libs/SHA256SUMS', fingerprint: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -159,5 +162,4 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import com.eactive.eai.adapter.AdapterVO;
|
|||||||
import com.eactive.eai.adapter.handler.AdapterErrorMessageHandler;
|
import com.eactive.eai.adapter.handler.AdapterErrorMessageHandler;
|
||||||
import com.eactive.eai.adapter.handler.AdapterErrorMessageHandlerFactory;
|
import com.eactive.eai.adapter.handler.AdapterErrorMessageHandlerFactory;
|
||||||
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.dynamic.HttpAdapterServiceKey;
|
import com.eactive.eai.adapter.http.dynamic.HttpAdapterServiceKey;
|
||||||
import com.eactive.eai.adapter.http.dynamic.HttpAdapterServiceSupport;
|
import com.eactive.eai.adapter.http.dynamic.HttpAdapterServiceSupport;
|
||||||
import com.eactive.eai.adapter.http.dynamic.HttpDynamicInAdapterManager;
|
import com.eactive.eai.adapter.http.dynamic.HttpDynamicInAdapterManager;
|
||||||
@@ -137,36 +136,29 @@ public class DJBApiAdapterController implements HttpAdapterServiceKey {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(adapterGroupName + "-" + adapterName + ">>" + e.getMessage(), e);
|
logger.error(adapterGroupName + "-" + adapterName + ">>" + e.getMessage(), e);
|
||||||
|
|
||||||
String responseErrorMsg = null;
|
String errorMsg = null;
|
||||||
|
|
||||||
|
errorMsg = genErrorResponseMessage(adapterGroupName, adapterName,
|
||||||
|
transactionProp, e, adptMsgType, encode, errorResponseFormat);
|
||||||
if (e instanceof FilterException) {
|
if (e instanceof FilterException) {
|
||||||
responseErrorMsg = genErrorResponseMessage(adapterGroupName, adapterName,
|
|
||||||
transactionProp, MessageUtil.ERROR_CODE_AP_ERROR, e, adptMsgType, encode, errorResponseFormat);
|
|
||||||
FilterException e1 = (FilterException) e;
|
FilterException e1 = (FilterException) e;
|
||||||
this.logError(servletRequest, adapterGroupName, e1.getCode(), responseErrorMsg, transactionProp, e);
|
this.logError(servletRequest, uuid, adapterGroupName, e1.getCode(), errorMsg, transactionProp, e);
|
||||||
logger.error("ApiAdapterController] " + adapterGroupName + "-" + adapterName + ">>" + e.getMessage());
|
logger.error("ApiAdapterController] " + adapterGroupName + "-" + adapterName + ">>" + e.getMessage());
|
||||||
responseEntity = ResponseEntity.status(e1.getStatus()).contentType(mediaType).body(responseErrorMsg);
|
responseEntity = ResponseEntity.status(e1.getStatus()).contentType(mediaType).body(errorMsg);
|
||||||
} else if (e instanceof JwtAuthException) {
|
} else if (e instanceof JwtAuthException) {
|
||||||
responseErrorMsg = genErrorResponseMessage(adapterGroupName, adapterName,
|
|
||||||
transactionProp, MessageUtil.ERROR_CODE_AP_ERROR, e, adptMsgType, encode, errorResponseFormat);
|
|
||||||
JwtAuthException e1 = (JwtAuthException) e;
|
JwtAuthException e1 = (JwtAuthException) e;
|
||||||
this.logError(servletRequest, adapterGroupName, e1.getCode(), responseErrorMsg, transactionProp, e);
|
this.logError(servletRequest, uuid, adapterGroupName, e1.getCode(), errorMsg, transactionProp, e);
|
||||||
logger.error("ApiAdapterController] " + adapterGroupName + "-" + adapterName + ">>" + e.getMessage(), e);
|
logger.error("ApiAdapterController] " + adapterGroupName + "-" + adapterName + ">>" + e.getMessage(), e);
|
||||||
responseEntity = ResponseEntity.status(HttpStatus.UNAUTHORIZED).contentType(mediaType).body(responseErrorMsg);
|
responseEntity = ResponseEntity.status(HttpStatus.UNAUTHORIZED).contentType(mediaType).body(errorMsg);
|
||||||
} else if (e instanceof HttpStatusException) {
|
} else if (e instanceof HttpStatusException) {
|
||||||
responseErrorMsg = genErrorResponseMessage(adapterGroupName, adapterName,
|
|
||||||
transactionProp, MessageUtil.ERROR_CODE_AUTH_FAIL, e, adptMsgType, encode, errorResponseFormat);
|
|
||||||
logger.error("ApiAdapterController] " + adapterGroupName + "-" + adapterName + ">>" + e.getMessage());
|
logger.error("ApiAdapterController] " + adapterGroupName + "-" + adapterName + ">>" + e.getMessage());
|
||||||
HttpStatusException e1 = (HttpStatusException) e;
|
HttpStatusException e1 = (HttpStatusException) e;
|
||||||
responseEntity = ResponseEntity.status(e1.getStatus()).contentType(mediaType).body(responseErrorMsg);
|
responseEntity = ResponseEntity.status(e1.getStatus()).contentType(mediaType).body(errorMsg);
|
||||||
} else {
|
} else {
|
||||||
responseErrorMsg = genErrorResponseMessage(adapterGroupName, adapterName,
|
|
||||||
transactionProp, MessageUtil.ERROR_CODE_AP_ERROR, e, adptMsgType, encode, errorResponseFormat);
|
|
||||||
this.logError(servletRequest, adapterGroupName, MessageUtil.ERROR_CODE_AP_ERROR, responseErrorMsg, transactionProp, e);
|
|
||||||
logger.error(adapterGroupName + "-" + adapterName + ">>" + e.getMessage(), e);
|
logger.error(adapterGroupName + "-" + adapterName + ">>" + e.getMessage(), e);
|
||||||
responseEntity = ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).contentType(mediaType).body(responseErrorMsg);
|
responseEntity = ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).contentType(mediaType).body(errorMsg);
|
||||||
}
|
}
|
||||||
responseData = responseErrorMsg;
|
responseData = errorMsg;
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
/**
|
/**
|
||||||
@@ -186,7 +178,7 @@ public class DJBApiAdapterController implements HttpAdapterServiceKey {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String genErrorResponseMessage(String adapterGroupName, String adapterName,
|
private String genErrorResponseMessage(String adapterGroupName, String adapterName,
|
||||||
Properties callProp, String code, Throwable e, String adptMsgType, String encode, String errorResponseFormat) {
|
Properties callProp, Throwable e, String adptMsgType, String encode, String errorResponseFormat) {
|
||||||
String errorHandlerClass = AdapterPropManager.getInstance().getProperty(adapterName, "ERR_MSG_HANDLER");
|
String errorHandlerClass = AdapterPropManager.getInstance().getProperty(adapterName, "ERR_MSG_HANDLER");
|
||||||
if (StringUtils.isNotBlank(errorHandlerClass)) {
|
if (StringUtils.isNotBlank(errorHandlerClass)) {
|
||||||
if (logger.isInfo())
|
if (logger.isInfo())
|
||||||
@@ -195,7 +187,6 @@ public class DJBApiAdapterController implements HttpAdapterServiceKey {
|
|||||||
if (handler != null) {
|
if (handler != null) {
|
||||||
Object resposne;
|
Object resposne;
|
||||||
try {
|
try {
|
||||||
callProp.put("INBOUND_RESULT_CODE", code);
|
|
||||||
resposne = handler.generateNonStandardInboundErrorResponseMessage(adapterGroupName, adapterName,
|
resposne = handler.generateNonStandardInboundErrorResponseMessage(adapterGroupName, adapterName,
|
||||||
callProp, null, null, e);
|
callProp, null, null, e);
|
||||||
return (String)resposne;
|
return (String)resposne;
|
||||||
@@ -206,7 +197,7 @@ public class DJBApiAdapterController implements HttpAdapterServiceKey {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return MessageUtil.makeErrorMessageByMessageType(adptMsgType, encode,
|
return MessageUtil.makeErrorMessageByMessageType(adptMsgType, encode,
|
||||||
code, e.getMessage(), errorResponseFormat);
|
MessageUtil.ERROR_CODE_AP_ERROR, e.getMessage(), errorResponseFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -259,14 +250,21 @@ public class DJBApiAdapterController implements HttpAdapterServiceKey {
|
|||||||
String errorCode = "RECEAIIRP010";
|
String errorCode = "RECEAIIRP010";
|
||||||
String[] msgArgs = new String[1];
|
String[] msgArgs = new String[1];
|
||||||
msgArgs[0] = request.getRequestURI();
|
msgArgs[0] = request.getRequestURI();
|
||||||
this.logError(request, "HTTP_IN_NO_URI", errorCode,
|
EAIServerManager eaiServerManager = EAIServerManager.getInstance();
|
||||||
|
String serverName = eaiServerManager.getLocalServerName();
|
||||||
|
|
||||||
|
String instanceid1 = serverName.substring(0, 2);
|
||||||
|
String instanceid2 = serverName.substring(serverName.length() - 2, serverName.length());
|
||||||
|
String instid = instanceid1 + instanceid2;
|
||||||
|
String uuid = instid + UUIDGenerator.getUUID();
|
||||||
|
this.logError(request, uuid, "HTTP_IN_NO_URI", errorCode,
|
||||||
ExceptionUtil.make(new Exception("cat not find uri"), errorCode, msgArgs), null, null);
|
ExceptionUtil.make(new Exception("cat not find uri"), errorCode, msgArgs), null, null);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
logger.warn("inbound logging failed", t);
|
logger.warn("inbound logging failed", t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logError(HttpServletRequest request, String adapterGroupName, String errorCode,
|
private void logError(HttpServletRequest request, String uuid, String adapterGroupName, String errorCode,
|
||||||
String errorMsg, Properties prop, Exception e) {
|
String errorMsg, Properties prop, Exception e) {
|
||||||
try {
|
try {
|
||||||
EAIServerManager eaiServerManager = EAIServerManager.getInstance();
|
EAIServerManager eaiServerManager = EAIServerManager.getInstance();
|
||||||
@@ -274,15 +272,7 @@ public class DJBApiAdapterController implements HttpAdapterServiceKey {
|
|||||||
|
|
||||||
InboundErrorInfoVO errorInfoVO = new InboundErrorInfoVO();
|
InboundErrorInfoVO errorInfoVO = new InboundErrorInfoVO();
|
||||||
|
|
||||||
String txId = prop.getProperty(TransactionContextKeys.TRANSACTION_UUID);
|
errorInfoVO.setEaiSvcSno(uuid); // EAI서비스일련번호
|
||||||
if (StringUtils.isEmpty(txId)) {
|
|
||||||
String instanceid1 = serverName.substring(0, 2);
|
|
||||||
String instanceid2 = serverName.substring(serverName.length() - 2, serverName.length());
|
|
||||||
String instid = instanceid1 + instanceid2;
|
|
||||||
txId = instid + UUIDGenerator.getUUID();
|
|
||||||
}
|
|
||||||
|
|
||||||
errorInfoVO.setEaiSvcSno(txId); // EAI서비스일련번호
|
|
||||||
errorInfoVO.setAdptBwkGrpNm(adapterGroupName); // 어댑터업무그룹명
|
errorInfoVO.setAdptBwkGrpNm(adapterGroupName); // 어댑터업무그룹명
|
||||||
errorInfoVO.setErrCd(errorCode); // 에러코드
|
errorInfoVO.setErrCd(errorCode); // 에러코드
|
||||||
errorInfoVO.setErrTxt(errorMsg); // 에러내용
|
errorInfoVO.setErrTxt(errorMsg); // 에러내용
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenCo
|
|||||||
import org.springframework.security.oauth2.provider.token.store.JwtTokenStore;
|
import org.springframework.security.oauth2.provider.token.store.JwtTokenStore;
|
||||||
import org.springframework.security.oauth2.provider.token.store.KeyStoreKeyFactory;
|
import org.springframework.security.oauth2.provider.token.store.KeyStoreKeyFactory;
|
||||||
|
|
||||||
import com.eactive.eai.agent.encryption.EncryptionManager;
|
|
||||||
import com.eactive.eai.authserver.dao.TokenIssuanceLogDAO;
|
import com.eactive.eai.authserver.dao.TokenIssuanceLogDAO;
|
||||||
import com.eactive.eai.authserver.jwt.PssJwtAccessTokenConverter;
|
import com.eactive.eai.authserver.jwt.PssJwtAccessTokenConverter;
|
||||||
import com.eactive.eai.authserver.service.OAuth2Manager;
|
import com.eactive.eai.authserver.service.OAuth2Manager;
|
||||||
@@ -132,11 +131,10 @@ public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdap
|
|||||||
String keyAlias = "elink-oauth";
|
String keyAlias = "elink-oauth";
|
||||||
String keyPassword = "elink1234";
|
String keyPassword = "elink1234";
|
||||||
if (vo != null) {
|
if (vo != null) {
|
||||||
EncryptionManager encManager = EncryptionManager.getInstance();
|
keystorePath = vo.getProperty(PROP_KEYSTORE_PATH);
|
||||||
keystorePath = encManager.decryptDBData(vo.getProperty(PROP_KEYSTORE_PATH));
|
keystorePassword = vo.getProperty(PROP_KEYSTORE_PW);
|
||||||
keystorePassword = encManager.decryptDBData(vo.getProperty(PROP_KEYSTORE_PW));
|
keyAlias = vo.getProperty(PROP_KEY_ALIAS);
|
||||||
keyAlias = encManager.decryptDBData(vo.getProperty(PROP_KEY_ALIAS));
|
keyPassword = vo.getProperty(PROP_KEY_PW);
|
||||||
keyPassword = encManager.decryptDBData(vo.getProperty(PROP_KEY_PW));
|
|
||||||
} else {
|
} else {
|
||||||
logger.warn("The properties has not been set.[" + PROP_GROUP_AUTH_SERVER + "]");
|
logger.warn("The properties has not been set.[" + PROP_GROUP_AUTH_SERVER + "]");
|
||||||
}
|
}
|
||||||
|
|||||||
-76
@@ -1,76 +0,0 @@
|
|||||||
package com.eactive.eai.custom.adapter.http.dynamic.filter;
|
|
||||||
|
|
||||||
import java.security.KeyStore;
|
|
||||||
import java.util.Base64;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import javax.crypto.SecretKey;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
import org.json.simple.JSONObject;
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
|
|
||||||
import com.eactive.eai.adapter.http.dynamic.filter.FilterException;
|
|
||||||
import com.eactive.eai.adapter.http.dynamic.filter.HttpAdapterFilter;
|
|
||||||
import com.eactive.eai.common.hsm.HsmManager;
|
|
||||||
import com.eactive.eai.common.util.Logger;
|
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
|
||||||
|
|
||||||
public class HSMKeyCryptoFilter implements HttpAdapterFilter {
|
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(Logger.LOGGER_ADAPTER);
|
|
||||||
|
|
||||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object doPreFilter(String adptGrpName, String adptName, Object message, Properties prop,
|
|
||||||
HttpServletRequest request, HttpServletResponse response) throws Exception {
|
|
||||||
try {
|
|
||||||
ObjectNode rootNode = null;
|
|
||||||
String jsonStr = null;
|
|
||||||
if (message instanceof String) {
|
|
||||||
jsonStr = (String) message;
|
|
||||||
} else if (message instanceof JSONObject) {
|
|
||||||
jsonStr = ((JSONObject) message).toJSONString();
|
|
||||||
} else {
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
rootNode = (ObjectNode)OBJECT_MAPPER.readTree(jsonStr);
|
|
||||||
|
|
||||||
JsonNode hsmKeyAlias = rootNode.get("hsmKeyAlias");
|
|
||||||
if (hsmKeyAlias != null) {
|
|
||||||
String hsmKeyAliasValue = hsmKeyAlias.textValue();
|
|
||||||
KeyStore keyStore = HsmManager.getInstance().getKeyStore();
|
|
||||||
|
|
||||||
java.security.Key key = keyStore.getKey(hsmKeyAliasValue, null);
|
|
||||||
if (key instanceof SecretKey) {
|
|
||||||
SecretKey secretKey = (SecretKey) key;
|
|
||||||
byte[] encoded = secretKey.getEncoded();
|
|
||||||
if (encoded != null) {
|
|
||||||
String encBase64 = Base64.getEncoder().encodeToString(encoded);
|
|
||||||
logger.debug("HsmManager] HSM - {} : [{}]", hsmKeyAliasValue, encBase64);
|
|
||||||
rootNode.put("hsmKeyBase64", encBase64);
|
|
||||||
rootNode.put("hsmKeyRaw", new String(encoded));
|
|
||||||
} else {
|
|
||||||
logger.debug("HsmManager] HSM - secretKey null {} : [{}]", hsmKeyAliasValue, secretKey);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
String jsonString = OBJECT_MAPPER.writeValueAsString(rootNode);
|
|
||||||
return jsonString;
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new FilterException("HSM key 가져오기 실패", ERROR_PRE_FAIL, HttpStatus.INTERNAL_SERVER_ERROR.value(), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object doPostFilter(String adptGrpName, String adptName, Object resultMessage, Properties prop,
|
|
||||||
HttpServletRequest request, HttpServletResponse response) throws Exception {
|
|
||||||
return resultMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user