2 Commits

Author SHA1 Message Date
rinjae 9d04435f13 Jenkinsfile 업데이트 2026-06-18 11:59:35 +09:00
rinjae 4a7669d4c0 Jenkinsfile 추가 2026-06-18 11:52:20 +09:00
2 changed files with 4 additions and 77 deletions
Vendored
+4 -1
View File
@@ -1,6 +1,10 @@
pipeline {
agent { label 'djb-vm' }
triggers {
pollSCM('H/10 * * * *')
}
options {
timestamps()
disableConcurrentBuilds()
@@ -158,5 +162,4 @@ pipeline {
}
}
}
}
@@ -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;
}
}