refactor(itms): common 모듈 추출 — 중복 클래스 단일화 (INTEGRATION_DESIGN §3-2)
behavior-identical 확인된 4개 플레인 클래스를 com.urpsys.common 으로 단일화하고
5개 모듈이 implementation project(':common') 으로 참조하도록 전환.
추출(사본 대조 후 동작 등가 확정):
- crypto/Aes256Cipher (5벌→1): 암호로직 전 사본 동일. front 키스토어 상이(UrpSysKeyMng)
→ 생성자 파라미터화(무인자=UrpSystem 기본, front EncryptConfig 만 명시).
미사용 dead 변수(activeProfile) 제거로 CommonUtil 의존 인라인.
- exception/CustomException (5벌→1): 전 사본 로직 동일(주석·brace 스타일 차이만).
- util/ConvertUtils (api·front→1): 동일. batch 는 LinkedHashMap 분기(기능 상이) → batch 로컬 유지.
- util/DataSourceUtil (api·auth·batch·datatrans→1): 로직 동일(미사용 import 차이만).
모듈 잔류(특화·안전상 미추출, 사유 기록):
- config/EncryptConfig·PasswordEncoderConfig(@Configuration): 모듈별 @ComponentScan 이
자기 패키지 한정(api·auth·datatrans·front) → common 이관 시 빈 미등록. EncryptConfig 는
front 키스토어 특화도 겸함. 각 모듈 로컬 유지하되 common Aes256Cipher 참조로 전환.
- CommonUtil·RestApiCallUtil·HtmlEmailUtil: 사본 간 실기능 분기 大(73~293라인) → 강제 초집합 시
동작 변경 위험 → 모듈 로컬 유지.
빌드: common·auth·api·batch·datatrans·front compileJava 전부 SUCCESS(--rerun-tasks).
인코딩: 소스 UTF-8, 루트 subprojects JavaCompile encoding=UTF-8 명시(플랫폼 CP949 회귀 방지).
Bean 이름(aes256Cipher)·프로파일·포트 불변. 시크릿 미기재.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
0218388c31
commit
5006ba6ad9
@ -33,6 +33,8 @@ ext
|
||||
|
||||
dependencies
|
||||
{
|
||||
implementation project(':common')
|
||||
|
||||
|
||||
implementation 'org.springframework.boot:spring-boot-starter-batch'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-cache'
|
||||
|
||||
@ -1,114 +0,0 @@
|
||||
package com.urpsys.baseapi.common.exception;
|
||||
|
||||
import java.sql.SQLSyntaxErrorException;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* Custom exception 클래스
|
||||
*
|
||||
* @author 나혁제
|
||||
* @since 2023.02.28
|
||||
* @version 1.0.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* << 개정이력(Modification information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ----------- --------- ------------------------
|
||||
* 2023.02.28 나혁제 최초작성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
public class CustomException extends Exception
|
||||
{
|
||||
private static final long serialVersionUID = 3559302713942492181L;
|
||||
|
||||
@Getter
|
||||
private String errorCode;
|
||||
|
||||
@Getter
|
||||
private String errorMsg;
|
||||
|
||||
/**
|
||||
* 생성자(throwable를 받아서 exception 종류에 따라 에러 코드 정의하는 클래스)
|
||||
* 에러코드 처리 부분은 향후 db에서 에러코드 읽어와서 매핑하는 것으로
|
||||
* 변경 가능성 있음
|
||||
* @param throwable
|
||||
*/
|
||||
public CustomException(Throwable throwable) {
|
||||
Throwable rootThrowable = getRootCause(throwable);
|
||||
|
||||
// TODO 에러 코드는 상세 정의해서 define 해야 함
|
||||
if(rootThrowable instanceof SQLSyntaxErrorException) {
|
||||
this.errorCode = "100";
|
||||
this.errorMsg = "SQL 오류";
|
||||
} else if(rootThrowable instanceof ArithmeticException) {
|
||||
this.errorCode = "200";
|
||||
this.errorMsg = "연산 오류";
|
||||
} else {
|
||||
this.errorCode = "900";
|
||||
this.errorMsg = "Unknown Error";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 생성자(에러메시지만 받을 경우 에러코드를 0을 default로 세팅)
|
||||
* @param errorMsg
|
||||
*/
|
||||
public CustomException(String errorMsg) {
|
||||
super(errorMsg);
|
||||
this.errorCode = "0";
|
||||
this.errorMsg = errorMsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* 생성자(errorcode, errmsg를 받아 세팅, 소스코드에서 편하게 사용하기 위해
|
||||
* 에러코드를 int 값으로 받으면 string으로 변환하여 저장)
|
||||
* @param errorCode
|
||||
* @param errorMsg
|
||||
*/
|
||||
public CustomException(int errorCode, String errorMsg) {
|
||||
super(errorMsg);
|
||||
this.errorCode = String.valueOf(errorCode);
|
||||
this.errorMsg = errorMsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* 생성자(에러코드, 에러메시지를 받아 세팅)
|
||||
* @param errorCode
|
||||
* @param errorMsg
|
||||
*/
|
||||
public CustomException(String errorCode, String errorMsg) {
|
||||
super(errorMsg);
|
||||
this.errorCode = errorCode;
|
||||
this.errorMsg = errorMsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* stack에서 에러코드 중 root cause를 찾아내는 메소드
|
||||
* @param throwable
|
||||
* @return
|
||||
*/
|
||||
private Throwable getRootCause(Throwable throwable) {
|
||||
Throwable cause = throwable.getCause();
|
||||
|
||||
if (cause == null) {
|
||||
return throwable;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
|
||||
if(cause.getCause() == null) {
|
||||
break;
|
||||
} else {
|
||||
cause = cause.getCause();
|
||||
}
|
||||
}
|
||||
|
||||
return cause;
|
||||
}
|
||||
}
|
||||
@ -26,7 +26,7 @@ import org.springframework.security.oauth2.provider.token.RemoteTokenServices;
|
||||
import com.google.gson.FieldNamingPolicy;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.urpsys.baseapi.common.exception.CustomException;
|
||||
import com.urpsys.common.exception.CustomException;
|
||||
import com.urpsys.baseapi.domain.TokenInfo;
|
||||
|
||||
|
||||
|
||||
@ -1,113 +0,0 @@
|
||||
package com.urpsys.baseapi.common.util;
|
||||
|
||||
import java.sql.Connection;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.mybatis.spring.SqlSessionFactoryBean;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
|
||||
import com.urpsys.baseapi.common.crypto.Aes256Cipher;
|
||||
import com.urpsys.baseapi.common.exception.CustomException;
|
||||
import com.zaxxer.hikari.HikariConfig;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
|
||||
/**
|
||||
* Datasource 생성하는 유틸리티
|
||||
*
|
||||
* @author 나혁제
|
||||
* @since 2023.02.28
|
||||
* @version 1.0.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* << 개정이력(Modification information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ----------- --------- ------------------------
|
||||
* 2023.02.28 나혁제 최초작성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
public class DataSourceUtil
|
||||
{
|
||||
/**
|
||||
* 데이터 소스 만드는 메소드
|
||||
* @param dataSourceName
|
||||
* @param env
|
||||
* @param cipher
|
||||
* @return
|
||||
*/
|
||||
public static DataSource createDataSource(String dataSourceName, Environment env, Aes256Cipher cipher)
|
||||
{
|
||||
HikariConfig config = new HikariConfig();
|
||||
|
||||
config.setDriverClassName (env.getProperty(dataSourceName + ".driverClassName" ));
|
||||
config.setJdbcUrl (env.getProperty(dataSourceName + ".jdbcUrl" ));
|
||||
|
||||
config.setUsername (cipher.decrypt(env.getProperty(dataSourceName + ".username")));
|
||||
config.setPassword (cipher.decrypt(env.getProperty(dataSourceName + ".password")));
|
||||
|
||||
config.setAutoCommit(false);
|
||||
|
||||
config.setMaximumPoolSize (Integer.parseInt(env.getProperty(dataSourceName + ".maximumPoolSize" )));
|
||||
config.setMinimumIdle (Integer.parseInt(env.getProperty(dataSourceName + ".minimumIdle" )));
|
||||
config.setConnectionTimeout (Long.parseLong (env.getProperty(dataSourceName + ".connectionTimeout" )));
|
||||
config.setIdleTimeout (Long.parseLong (env.getProperty(dataSourceName + ".idleTimeout" )));
|
||||
|
||||
config.addDataSourceProperty("cachePrepStmts" , "true");
|
||||
config.addDataSourceProperty("prepStmtCacheSize" , "250");
|
||||
config.addDataSourceProperty("prepStmtCacheSqlLimit" , "2048");
|
||||
|
||||
return new HikariDataSource(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* SqlSessionFactory 만드는 메소드
|
||||
* @param dataSource
|
||||
* @param configLocation
|
||||
* @param mapperLocation
|
||||
* @return
|
||||
* @throws CustomException
|
||||
*/
|
||||
public static SqlSessionFactory createSqlSessionFactory(DataSource dataSource, Resource configLocation,
|
||||
Resource[] mapperLocation) throws CustomException
|
||||
{
|
||||
SqlSessionFactory sqlSessionFactory;
|
||||
|
||||
try {
|
||||
SqlSessionFactoryBean sessionFactoryBean = new SqlSessionFactoryBean();
|
||||
sessionFactoryBean.setDataSource(dataSource);
|
||||
sessionFactoryBean.setConfigLocation(configLocation);
|
||||
sessionFactoryBean.setMapperLocations(mapperLocation);
|
||||
|
||||
sqlSessionFactory = sessionFactoryBean.getObject();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new CustomException(ex.getMessage());
|
||||
}
|
||||
|
||||
return sqlSessionFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* 트랜잭션 처리 메소드
|
||||
* @param dataSource
|
||||
* @return
|
||||
*/
|
||||
public static DataSourceTransactionManager createTxManager(DataSource dataSource)
|
||||
{
|
||||
DataSourceTransactionManager txManager = new DataSourceTransactionManager(dataSource);
|
||||
txManager.setGlobalRollbackOnParticipationFailure(false);
|
||||
|
||||
return txManager;
|
||||
}
|
||||
|
||||
//end method
|
||||
}
|
||||
@ -26,7 +26,7 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import com.urpsys.baseapi.common.crypto.Aes256Cipher;
|
||||
import com.urpsys.common.crypto.Aes256Cipher;
|
||||
import com.urpsys.itmsapi.cmm.service.CmmUseService;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.urpsys.baseapi.common.util;
|
||||
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -17,7 +19,7 @@ import org.springframework.core.env.Environment;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.urpsys.baseapi.common.exception.CustomException;
|
||||
import com.urpsys.common.exception.CustomException;
|
||||
import com.urpsys.baseapi.domain.TokenInfo;
|
||||
|
||||
import kong.unirest.HttpResponse;
|
||||
|
||||
@ -6,7 +6,7 @@ import org.apache.commons.codec.DecoderException;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import com.urpsys.baseapi.common.crypto.Aes256Cipher;
|
||||
import com.urpsys.common.crypto.Aes256Cipher;
|
||||
|
||||
/**
|
||||
* 암호화 유틸리티를 등록하는 클래스
|
||||
|
||||
@ -14,7 +14,7 @@ import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.urpsys.baseapi.common.crypto.Aes256Cipher;
|
||||
import com.urpsys.common.crypto.Aes256Cipher;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ import kong.unirest.JsonNode;
|
||||
import kong.unirest.Unirest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import com.urpsys.baseapi.common.exception.CustomException;
|
||||
import com.urpsys.common.exception.CustomException;
|
||||
import com.urpsys.baseapi.domain.CommonVO;
|
||||
import com.urpsys.baseapi.domain.JWTKey;
|
||||
import com.urpsys.baseapi.service.CommonService;
|
||||
|
||||
@ -18,9 +18,9 @@ import org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
import com.urpsys.baseapi.common.crypto.Aes256Cipher;
|
||||
import com.urpsys.baseapi.common.exception.CustomException;
|
||||
import com.urpsys.baseapi.common.util.DataSourceUtil;
|
||||
import com.urpsys.common.crypto.Aes256Cipher;
|
||||
import com.urpsys.common.exception.CustomException;
|
||||
import com.urpsys.common.util.DataSourceUtil;
|
||||
|
||||
/**
|
||||
* primary db config 클래스
|
||||
|
||||
@ -9,7 +9,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.urpsys.itmsapi.cmm.dao.FileManageDao;
|
||||
|
||||
import com.urpsys.baseapi.common.exception.CustomException;
|
||||
import com.urpsys.common.exception.CustomException;
|
||||
|
||||
/**
|
||||
* 파일을 처리하하는 비즈니스 구현 클래스를 정의
|
||||
|
||||
@ -30,6 +30,8 @@ ext
|
||||
|
||||
dependencies
|
||||
{
|
||||
implementation project(':common')
|
||||
|
||||
|
||||
implementation 'org.springframework.boot:spring-boot-starter-batch'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-cache'
|
||||
|
||||
@ -13,7 +13,7 @@ import java.util.Vector;
|
||||
import org.codehaus.jettison.json.JSONException;
|
||||
import org.codehaus.jettison.json.JSONObject;
|
||||
|
||||
import com.urpsys.baseauth.common.exception.CustomException;
|
||||
import com.urpsys.common.exception.CustomException;
|
||||
|
||||
/**
|
||||
* 공통 유틸리티를 모아둔 클래스
|
||||
|
||||
@ -1,111 +0,0 @@
|
||||
package com.urpsys.baseauth.common;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.mybatis.spring.SqlSessionFactoryBean;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
|
||||
import com.urpsys.baseauth.common.crypto.Aes256Cipher;
|
||||
import com.urpsys.baseauth.common.exception.CustomException;
|
||||
import com.zaxxer.hikari.HikariConfig;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
|
||||
/**
|
||||
* Datasource 생성하는 유틸리티
|
||||
*
|
||||
* @author 나혁제
|
||||
* @since 2023.02.28
|
||||
* @version 1.0.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* << 개정이력(Modification information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ----------- --------- ------------------------
|
||||
* 2023.02.28 나혁제 최초작성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
public class DataSourceUtil
|
||||
{
|
||||
/**
|
||||
* 데이터 소스 만드는 메소드
|
||||
* @param dataSourceName
|
||||
* @param env
|
||||
* @param cipher
|
||||
* @return
|
||||
*/
|
||||
public static DataSource createDataSource(String dataSourceName, Environment env, Aes256Cipher cipher)
|
||||
{
|
||||
HikariConfig config = new HikariConfig();
|
||||
|
||||
config.setDriverClassName (env.getProperty(dataSourceName + ".driverClassName" ));
|
||||
config.setJdbcUrl (env.getProperty(dataSourceName + ".jdbcUrl" ));
|
||||
|
||||
config.setUsername (cipher.decrypt(env.getProperty(dataSourceName + ".username")));
|
||||
config.setPassword (cipher.decrypt(env.getProperty(dataSourceName + ".password")));
|
||||
|
||||
config.setAutoCommit(false);
|
||||
|
||||
config.setMaximumPoolSize (Integer.parseInt(env.getProperty(dataSourceName + ".maximumPoolSize" )));
|
||||
config.setMinimumIdle (Integer.parseInt(env.getProperty(dataSourceName + ".minimumIdle" )));
|
||||
config.setConnectionTimeout (Long.parseLong (env.getProperty(dataSourceName + ".connectionTimeout" )));
|
||||
config.setIdleTimeout (Long.parseLong (env.getProperty(dataSourceName + ".idleTimeout" )));
|
||||
|
||||
config.addDataSourceProperty("cachePrepStmts" , "true");
|
||||
config.addDataSourceProperty("prepStmtCacheSize" , "250");
|
||||
config.addDataSourceProperty("prepStmtCacheSqlLimit" , "2048");
|
||||
|
||||
return new HikariDataSource(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* SqlSessionFactory 만드는 메소드
|
||||
* @param dataSource
|
||||
* @param configLocation
|
||||
* @param mapperLocation
|
||||
* @return
|
||||
* @throws CustomException
|
||||
*/
|
||||
public static SqlSessionFactory createSqlSessionFactory(DataSource dataSource, Resource configLocation,
|
||||
Resource[] mapperLocation) throws CustomException
|
||||
{
|
||||
SqlSessionFactory sqlSessionFactory;
|
||||
|
||||
try {
|
||||
SqlSessionFactoryBean sessionFactoryBean = new SqlSessionFactoryBean();
|
||||
sessionFactoryBean.setDataSource(dataSource);
|
||||
sessionFactoryBean.setConfigLocation(configLocation);
|
||||
sessionFactoryBean.setMapperLocations(mapperLocation);
|
||||
|
||||
sqlSessionFactory = sessionFactoryBean.getObject();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new CustomException(ex.getMessage());
|
||||
}
|
||||
|
||||
return sqlSessionFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* 트랜잭션 처리 메소드
|
||||
* @param dataSource
|
||||
* @return
|
||||
*/
|
||||
public static DataSourceTransactionManager createTxManager(DataSource dataSource)
|
||||
{
|
||||
DataSourceTransactionManager txManager = new DataSourceTransactionManager(dataSource);
|
||||
txManager.setGlobalRollbackOnParticipationFailure(false);
|
||||
|
||||
return txManager;
|
||||
}
|
||||
|
||||
//end method
|
||||
}
|
||||
@ -1,142 +0,0 @@
|
||||
package com.urpsys.baseauth.common.crypto;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
import org.apache.commons.codec.DecoderException;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.codec.binary.Hex;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
|
||||
import com.urpsys.baseauth.common.CommonUtil;
|
||||
|
||||
/**
|
||||
* aes 256 암호화 클래스
|
||||
*
|
||||
* @author 나혁제
|
||||
* @since 2023.02.28
|
||||
* @version 1.0.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* << 개정이력(Modification information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ----------- --------- ------------------------
|
||||
* 2023.02.28 나혁제 최초작성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
public class Aes256Cipher
|
||||
{
|
||||
private SecretKey keySpec; // keySpec
|
||||
private IvParameterSpec ivSpec; // ivSpec
|
||||
|
||||
/**
|
||||
* Aes256Cipher 생성자
|
||||
*
|
||||
* @param keyFile 키 파일 위치를 입력 받음
|
||||
* @throws IOException 파일 io 시 발생하는 익셉션
|
||||
* @throws InvalidKeyException key가 잘못되었을 경우 발생하는 익셉션
|
||||
* @throws DecoderException 암호화된 문자열을 decoding할 때 발생하는 익셉션
|
||||
*/
|
||||
public Aes256Cipher() throws IOException, InvalidKeyException, DecoderException {
|
||||
|
||||
String activeProfile = (CommonUtil.nvl(System.getProperty("spring.profiles.active")));
|
||||
|
||||
InputStream fis = null;
|
||||
String secretKey = null;
|
||||
|
||||
try
|
||||
{
|
||||
fis = new ClassPathResource("secrets/UrpSystem.keystore").getInputStream();
|
||||
|
||||
Properties props = new Properties();
|
||||
props.load(fis);
|
||||
secretKey = props.getProperty("aes256.key");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
fis.close();
|
||||
}
|
||||
|
||||
byte[] secretKeyBytes = Hex.decodeHex(secretKey);
|
||||
|
||||
if (secretKeyBytes.length != 32) {
|
||||
throw new InvalidKeyException("Invalid key (key length is not valid) ");
|
||||
}
|
||||
|
||||
byte[] ivBytes = new byte[16];
|
||||
|
||||
System.arraycopy(secretKeyBytes, 0, ivBytes, 0, 16);
|
||||
|
||||
keySpec = new SecretKeySpec(secretKeyBytes, "AES");
|
||||
ivSpec = new IvParameterSpec(ivBytes);
|
||||
}
|
||||
|
||||
/**
|
||||
* encryption 하는 메소드
|
||||
*
|
||||
* @param plainStr 평문을 입력 받음
|
||||
* @return 암호화된 문자열
|
||||
*/
|
||||
public String encrypt(String plainStr) {
|
||||
if (plainStr == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String encryptedStr = null;
|
||||
|
||||
try {
|
||||
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
|
||||
cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec);
|
||||
byte[] encrypted = cipher.doFinal(plainStr.getBytes("UTF-8"));
|
||||
encryptedStr = new String(Base64.encodeBase64(encrypted));
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
return encryptedStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 암호화된 문자열을 복호화하는 메소드
|
||||
*
|
||||
* @param encryptedStr 암호화된 문자열
|
||||
* @return 암호화가 해제된 문자열
|
||||
*/
|
||||
public String decrypt(String encryptedStr) {
|
||||
if (encryptedStr == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
String decryptedStr = null;
|
||||
|
||||
try {
|
||||
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
|
||||
|
||||
cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec);
|
||||
byte[] byteStr = Base64.decodeBase64(encryptedStr.getBytes("UTF-8"));
|
||||
decryptedStr = new String(cipher.doFinal(byteStr), "UTF-8");
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
return decryptedStr;
|
||||
}
|
||||
}
|
||||
@ -1,114 +0,0 @@
|
||||
package com.urpsys.baseauth.common.exception;
|
||||
|
||||
import java.sql.SQLSyntaxErrorException;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* Custom exception 클래스
|
||||
*
|
||||
* @author 나혁제
|
||||
* @since 2023.02.28
|
||||
* @version 1.0.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* << 개정이력(Modification information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ----------- --------- ------------------------
|
||||
* 2023.02.28 나혁제 최초작성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
public class CustomException extends Exception
|
||||
{
|
||||
private static final long serialVersionUID = 3559302713942492181L;
|
||||
|
||||
@Getter
|
||||
private String errorCode;
|
||||
|
||||
@Getter
|
||||
private String errorMsg;
|
||||
|
||||
/**
|
||||
* 생성자(throwable를 받아서 exception 종류에 따라 에러 코드 정의하는 클래스)
|
||||
* 에러코드 처리 부분은 향후 db에서 에러코드 읽어와서 매핑하는 것으로
|
||||
* 변경 가능성 있음
|
||||
* @param throwable
|
||||
*/
|
||||
public CustomException(Throwable throwable) {
|
||||
Throwable rootThrowable = getRootCause(throwable);
|
||||
|
||||
// TODO 에러 코드는 상세 정의해서 define 해야 함
|
||||
if(rootThrowable instanceof SQLSyntaxErrorException) {
|
||||
this.errorCode = "100";
|
||||
this.errorMsg = "SQL 오류";
|
||||
} else if(rootThrowable instanceof ArithmeticException) {
|
||||
this.errorCode = "200";
|
||||
this.errorMsg = "연산 오류";
|
||||
} else {
|
||||
this.errorCode = "900";
|
||||
this.errorMsg = "Unknown Error";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 생성자(에러메시지만 받을 경우 에러코드를 0을 default로 세팅)
|
||||
* @param errorMsg
|
||||
*/
|
||||
public CustomException(String errorMsg) {
|
||||
super(errorMsg);
|
||||
this.errorCode = "0";
|
||||
this.errorMsg = errorMsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* 생성자(errorcode, errmsg를 받아 세팅, 소스코드에서 편하게 사용하기 위해
|
||||
* 에러코드를 int 값으로 받으면 string으로 변환하여 저장)
|
||||
* @param errorCode
|
||||
* @param errorMsg
|
||||
*/
|
||||
public CustomException(int errorCode, String errorMsg) {
|
||||
super(errorMsg);
|
||||
this.errorCode = String.valueOf(errorCode);
|
||||
this.errorMsg = errorMsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* 생성자(에러코드, 에러메시지를 받아 세팅)
|
||||
* @param errorCode
|
||||
* @param errorMsg
|
||||
*/
|
||||
public CustomException(String errorCode, String errorMsg) {
|
||||
super(errorMsg);
|
||||
this.errorCode = errorCode;
|
||||
this.errorMsg = errorMsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* stack에서 에러코드 중 root cause를 찾아내는 메소드
|
||||
* @param throwable
|
||||
* @return
|
||||
*/
|
||||
private Throwable getRootCause(Throwable throwable) {
|
||||
Throwable cause = throwable.getCause();
|
||||
|
||||
if (cause == null) {
|
||||
return throwable;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
|
||||
if(cause.getCause() == null) {
|
||||
break;
|
||||
} else {
|
||||
cause = cause.getCause();
|
||||
}
|
||||
}
|
||||
|
||||
return cause;
|
||||
}
|
||||
}
|
||||
@ -6,7 +6,7 @@ import org.apache.commons.codec.DecoderException;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import com.urpsys.baseauth.common.crypto.Aes256Cipher;
|
||||
import com.urpsys.common.crypto.Aes256Cipher;
|
||||
|
||||
/**
|
||||
* 암호화 유틸리티를 등록하는 클래스
|
||||
|
||||
@ -24,7 +24,7 @@ import org.springframework.security.oauth2.provider.token.store.JdbcTokenStore;
|
||||
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter;
|
||||
import org.springframework.security.oauth2.provider.token.store.KeyStoreKeyFactory;
|
||||
|
||||
import com.urpsys.baseauth.common.crypto.Aes256Cipher;
|
||||
import com.urpsys.common.crypto.Aes256Cipher;
|
||||
import com.urpsys.baseauth.service.UserDetailService;
|
||||
import com.zaxxer.hikari.HikariConfig;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
|
||||
@ -18,9 +18,9 @@ import org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
import com.urpsys.baseauth.common.DataSourceUtil;
|
||||
import com.urpsys.baseauth.common.crypto.Aes256Cipher;
|
||||
import com.urpsys.baseauth.common.exception.CustomException;
|
||||
import com.urpsys.common.util.DataSourceUtil;
|
||||
import com.urpsys.common.crypto.Aes256Cipher;
|
||||
import com.urpsys.common.exception.CustomException;
|
||||
|
||||
/**
|
||||
* primary db config 클래스
|
||||
|
||||
@ -33,6 +33,8 @@ ext
|
||||
|
||||
dependencies
|
||||
{
|
||||
implementation project(':common')
|
||||
|
||||
implementation 'org.springframework.boot:spring-boot-starter-batch'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-quartz'
|
||||
|
||||
|
||||
@ -1,152 +0,0 @@
|
||||
package com.urpsys.basebatch.common.crypto;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
import com.urpsys.basebatch.common.util.CommonUtil;
|
||||
|
||||
import org.apache.commons.codec.DecoderException;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.codec.binary.Hex;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
|
||||
/**
|
||||
* aes 256 암호화 클래스
|
||||
*
|
||||
* @author urp 인프라본부 나혁제
|
||||
* @since 2025.04.03
|
||||
* @version 1.0.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* << 개정이력(Modification information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ----------- --------- ------------------------
|
||||
* 2025.04.03 나혁제 최초작성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
public class Aes256Cipher
|
||||
{
|
||||
private SecretKey keySpec; // keySpec
|
||||
private IvParameterSpec ivSpec; // ivSpec
|
||||
|
||||
/**
|
||||
* Aes256Cipher 생성자
|
||||
*
|
||||
* @param keyFile 키 파일 위치를 입력 받음
|
||||
* @throws IOException 파일 io 시 발생하는 익셉션
|
||||
* @throws InvalidKeyException key가 잘못되었을 경우 발생하는 익셉션
|
||||
* @throws DecoderException 암호화된 문자열을 decoding할 때 발생하는 익셉션
|
||||
*/
|
||||
public Aes256Cipher() throws IOException, InvalidKeyException, DecoderException
|
||||
{
|
||||
|
||||
String activeProfile = (CommonUtil.nvl(System.getProperty("spring.profiles.active")));
|
||||
|
||||
InputStream fis = null;
|
||||
String secretKey = null;
|
||||
|
||||
try
|
||||
{
|
||||
fis = new ClassPathResource("secrets/UrpSystem.keystore").getInputStream();
|
||||
|
||||
Properties props = new Properties();
|
||||
props.load(fis);
|
||||
secretKey = props.getProperty("aes256.key");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
fis.close();
|
||||
}
|
||||
|
||||
byte[] secretKeyBytes = Hex.decodeHex(secretKey);
|
||||
|
||||
if (secretKeyBytes.length != 32) {
|
||||
throw new InvalidKeyException("Invalid key (key length is not valid) ");
|
||||
}
|
||||
|
||||
byte[] ivBytes = new byte[16];
|
||||
|
||||
System.arraycopy(secretKeyBytes, 0, ivBytes, 0, 16);
|
||||
|
||||
keySpec = new SecretKeySpec(secretKeyBytes, "AES");
|
||||
ivSpec = new IvParameterSpec(ivBytes);
|
||||
}
|
||||
|
||||
/**
|
||||
* encryption 하는 메소드
|
||||
*
|
||||
* @param plainStr 평문을 입력 받음
|
||||
* @return 암호화된 문자열
|
||||
*/
|
||||
public String encrypt(String plainStr)
|
||||
{
|
||||
if (plainStr == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
String encryptedStr = null;
|
||||
|
||||
try
|
||||
{
|
||||
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
|
||||
cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec);
|
||||
byte[] encrypted = cipher.doFinal(plainStr.getBytes("UTF-8"));
|
||||
encryptedStr = new String(Base64.encodeBase64(encrypted));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
return encryptedStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 암호화된 문자열을 복호화하는 메소드
|
||||
*
|
||||
* @param encryptedStr 암호화된 문자열
|
||||
* @return 암호화가 해제된 문자열
|
||||
*/
|
||||
public String decrypt(String encryptedStr)
|
||||
{
|
||||
if (encryptedStr == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
String decryptedStr = null;
|
||||
|
||||
try
|
||||
{
|
||||
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
|
||||
|
||||
cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec);
|
||||
byte[] byteStr = Base64.decodeBase64(encryptedStr.getBytes("UTF-8"));
|
||||
decryptedStr = new String(cipher.doFinal(byteStr), "UTF-8");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
return decryptedStr;
|
||||
}
|
||||
}
|
||||
@ -1,124 +0,0 @@
|
||||
package com.urpsys.basebatch.common.exception;
|
||||
|
||||
import java.sql.SQLSyntaxErrorException;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* Custom exception 클래스
|
||||
*
|
||||
* @author urp 인프라본부 나혁제
|
||||
* @since 2025.04.03
|
||||
* @version 1.0.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* << 개정이력(Modification information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ----------- --------- ------------------------
|
||||
* 2025.04.03 나혁제 최초작성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
public class CustomException extends Exception
|
||||
{
|
||||
private static final long serialVersionUID = 3559302713942492181L;
|
||||
|
||||
@Getter
|
||||
private String errorCode;
|
||||
|
||||
@Getter
|
||||
private String errorMsg;
|
||||
|
||||
/**
|
||||
* 생성자(throwable를 받아서 exception 종류에 따라 에러 코드 정의하는 클래스)
|
||||
* 에러코드 처리 부분은 향후 db에서 에러코드 읽어와서 매핑하는 것으로
|
||||
* 변경 가능성 있음
|
||||
* @param throwable
|
||||
*/
|
||||
public CustomException(Throwable throwable)
|
||||
{
|
||||
Throwable rootThrowable = getRootCause(throwable);
|
||||
|
||||
// TODO 에러 코드는 상세 정의해서 define 해야 함
|
||||
if(rootThrowable instanceof SQLSyntaxErrorException)
|
||||
{
|
||||
this.errorCode = "100";
|
||||
this.errorMsg = "SQL 오류";
|
||||
}
|
||||
else if(rootThrowable instanceof ArithmeticException)
|
||||
{
|
||||
this.errorCode = "200";
|
||||
this.errorMsg = "연산 오류";
|
||||
}
|
||||
else
|
||||
{
|
||||
this.errorCode = "900";
|
||||
this.errorMsg = "Unknown Error";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 생성자(에러메시지만 받을 경우 에러코드를 0을 default로 세팅)
|
||||
* @param errorMsg
|
||||
*/
|
||||
public CustomException(String errorMsg)
|
||||
{
|
||||
super(errorMsg);
|
||||
this.errorCode = "0";
|
||||
this.errorMsg = errorMsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* 생성자(errorcode, errmsg를 받아 세팅, 소스코드에서 편하게 사용하기 위해
|
||||
* 에러코드를 int 값으로 받으면 string으로 변환하여 저장)
|
||||
* @param errorCode
|
||||
* @param errorMsg
|
||||
*/
|
||||
public CustomException(int errorCode, String errorMsg)
|
||||
{
|
||||
super(errorMsg);
|
||||
this.errorCode = String.valueOf(errorCode);
|
||||
this.errorMsg = errorMsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* 생성자(에러코드, 에러메시지를 받아 세팅)
|
||||
* @param errorCode
|
||||
* @param errorMsg
|
||||
*/
|
||||
public CustomException(String errorCode, String errorMsg)
|
||||
{
|
||||
super(errorMsg);
|
||||
this.errorCode = errorCode;
|
||||
this.errorMsg = errorMsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* stack에서 에러코드 중 root cause를 찾아내는 메소드
|
||||
* @param throwable
|
||||
* @return
|
||||
*/
|
||||
private Throwable getRootCause(Throwable throwable)
|
||||
{
|
||||
Throwable cause = throwable.getCause();
|
||||
|
||||
if (cause == null) {
|
||||
return throwable;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
|
||||
if(cause.getCause() == null) {
|
||||
break;
|
||||
} else {
|
||||
cause = cause.getCause();
|
||||
}
|
||||
}
|
||||
|
||||
return cause;
|
||||
}
|
||||
}
|
||||
@ -10,7 +10,7 @@ import java.util.Locale;
|
||||
import java.util.SimpleTimeZone;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.urpsys.basebatch.common.exception.CustomException;
|
||||
import com.urpsys.common.exception.CustomException;
|
||||
|
||||
/**
|
||||
* 공통 유틸리티를 모아둔 클래스
|
||||
|
||||
@ -1,113 +0,0 @@
|
||||
package com.urpsys.basebatch.common.util;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.mybatis.spring.SqlSessionFactoryBean;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
|
||||
import com.urpsys.basebatch.common.crypto.Aes256Cipher;
|
||||
import com.urpsys.basebatch.common.exception.CustomException;
|
||||
import com.zaxxer.hikari.HikariConfig;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
/**
|
||||
* Datasource 생성하는 유틸리티
|
||||
*
|
||||
* @author 나혁제
|
||||
* @since 2025.04.03
|
||||
* @version 1.0.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* << 개정이력(Modification information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ----------- --------- ------------------------
|
||||
* 2025.04.03 나혁제 최초작성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
public class DataSourceUtil
|
||||
{
|
||||
/**
|
||||
* 데이터 소스 만드는 메소드
|
||||
* @param dataSourceName
|
||||
* @param env
|
||||
* @param cipher
|
||||
* @return
|
||||
*/
|
||||
public static DataSource createDataSource(String dataSourceName, Environment env, Aes256Cipher cipher)
|
||||
{
|
||||
HikariConfig config = new HikariConfig();
|
||||
|
||||
config.setDriverClassName (env.getProperty(dataSourceName + ".driverClassName" ));
|
||||
config.setJdbcUrl (env.getProperty(dataSourceName + ".jdbcUrl" ));
|
||||
|
||||
config.setUsername (cipher.decrypt(env.getProperty(dataSourceName + ".username")));
|
||||
config.setPassword (cipher.decrypt(env.getProperty(dataSourceName + ".password")));
|
||||
|
||||
config.setAutoCommit(false);
|
||||
|
||||
config.setMaximumPoolSize (Integer.parseInt(env.getProperty(dataSourceName + ".maximumPoolSize" )));
|
||||
config.setMinimumIdle (Integer.parseInt(env.getProperty(dataSourceName + ".minimumIdle" )));
|
||||
config.setConnectionTimeout (Long.parseLong (env.getProperty(dataSourceName + ".connectionTimeout" )));
|
||||
config.setIdleTimeout (Long.parseLong (env.getProperty(dataSourceName + ".idleTimeout" )));
|
||||
|
||||
config.addDataSourceProperty("cachePrepStmts" , "true");
|
||||
config.addDataSourceProperty("prepStmtCacheSize" , "250");
|
||||
config.addDataSourceProperty("prepStmtCacheSqlLimit" , "2048");
|
||||
|
||||
return new HikariDataSource(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* SqlSessionFactory 만드는 메소드
|
||||
* @param dataSource
|
||||
* @param configLocation
|
||||
* @param mapperLocation
|
||||
* @return
|
||||
* @throws CustomException
|
||||
*/
|
||||
public static SqlSessionFactory createSqlSessionFactory(DataSource dataSource, Resource configLocation,
|
||||
Resource[] mapperLocation) throws CustomException
|
||||
{
|
||||
SqlSessionFactory sqlSessionFactory;
|
||||
|
||||
try {
|
||||
SqlSessionFactoryBean sessionFactoryBean = new SqlSessionFactoryBean();
|
||||
sessionFactoryBean.setDataSource(dataSource);
|
||||
sessionFactoryBean.setConfigLocation(configLocation);
|
||||
sessionFactoryBean.setMapperLocations(mapperLocation);
|
||||
|
||||
sqlSessionFactory = sessionFactoryBean.getObject();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new CustomException(ex.getMessage());
|
||||
}
|
||||
|
||||
return sqlSessionFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* 트랜잭션 처리 메소드
|
||||
* @param dataSource
|
||||
* @return
|
||||
*/
|
||||
public static DataSourceTransactionManager createTxManager(DataSource dataSource)
|
||||
{
|
||||
DataSourceTransactionManager txManager = new DataSourceTransactionManager(dataSource);
|
||||
txManager.setGlobalRollbackOnParticipationFailure(false);
|
||||
|
||||
return txManager;
|
||||
}
|
||||
|
||||
//end method
|
||||
}
|
||||
@ -14,7 +14,7 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.urpsys.basebatch.common.exception.CustomException;
|
||||
import com.urpsys.common.exception.CustomException;
|
||||
import com.urpsys.basebatch.domain.TokenInfo;
|
||||
import com.urpsys.basebatch.common.util.ConvertUtils;
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ package com.urpsys.basebatch.config;
|
||||
import java.io.IOException;
|
||||
import java.security.InvalidKeyException;
|
||||
|
||||
import com.urpsys.basebatch.common.crypto.Aes256Cipher;
|
||||
import com.urpsys.common.crypto.Aes256Cipher;
|
||||
|
||||
import org.apache.commons.codec.DecoderException;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
@ -19,9 +19,9 @@ import org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
import com.urpsys.basebatch.common.crypto.Aes256Cipher;
|
||||
import com.urpsys.basebatch.common.exception.CustomException;
|
||||
import com.urpsys.basebatch.common.util.DataSourceUtil;
|
||||
import com.urpsys.common.crypto.Aes256Cipher;
|
||||
import com.urpsys.common.exception.CustomException;
|
||||
import com.urpsys.common.util.DataSourceUtil;
|
||||
|
||||
/**
|
||||
* kic insa db config 클래스
|
||||
|
||||
@ -11,7 +11,7 @@ import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.urpsys.basebatch.common.crypto.Aes256Cipher;
|
||||
import com.urpsys.common.crypto.Aes256Cipher;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
|
||||
@ -19,9 +19,9 @@ import org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
import com.urpsys.basebatch.common.crypto.Aes256Cipher;
|
||||
import com.urpsys.basebatch.common.exception.CustomException;
|
||||
import com.urpsys.basebatch.common.util.DataSourceUtil;
|
||||
import com.urpsys.common.crypto.Aes256Cipher;
|
||||
import com.urpsys.common.exception.CustomException;
|
||||
import com.urpsys.common.util.DataSourceUtil;
|
||||
|
||||
/**
|
||||
* primary db config 클래스
|
||||
|
||||
@ -15,7 +15,7 @@ import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
||||
import com.urpsys.basebatch.common.crypto.Aes256Cipher;
|
||||
import com.urpsys.common.crypto.Aes256Cipher;
|
||||
import com.urpsys.basebatch.common.util.CommonUtil;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@ -15,6 +15,10 @@ allprojects {
|
||||
}
|
||||
|
||||
subprojects {
|
||||
// 소스는 UTF-8. 컴파일러 기본 인코딩이 플랫폼(CP949)일 수 있어 명시 고정(동작 등가·결정론).
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.encoding = 'UTF-8'
|
||||
}
|
||||
repositories {
|
||||
mavenCentral()
|
||||
// egovframe maven 원격 저장소. 단, spring-modules-validation 은 아래 artifact-only 저장소에서 취득.
|
||||
|
||||
37
common/build.gradle
Normal file
37
common/build.gradle
Normal file
@ -0,0 +1,37 @@
|
||||
// ITMS 통합 common 모듈 (INTEGRATION_DESIGN.md §2, §3-2)
|
||||
// 5개 모듈에 복붙 포크되어 있던 공통 클래스(behavior-identical 확인분)를 단일화.
|
||||
// 플레인 Java 라이브러리 — Boot 애플리케이션 아님(bootJar/bootWar 미생성).
|
||||
plugins {
|
||||
id 'io.spring.dependency-management'
|
||||
id 'java'
|
||||
}
|
||||
|
||||
group = 'com.urpsys'
|
||||
version = '1.0.0-SNAPSHOT'
|
||||
sourceCompatibility = '11' // 소비 모듈(11/16) 최저 호환. JDK17 컴파일러로 빌드.
|
||||
|
||||
configurations {
|
||||
compileOnly {
|
||||
extendsFrom annotationProcessor
|
||||
}
|
||||
}
|
||||
|
||||
dependencyManagement {
|
||||
imports {
|
||||
mavenBom "org.springframework.boot:spring-boot-dependencies:2.6.2"
|
||||
}
|
||||
}
|
||||
|
||||
// repositories: 루트 build.gradle subprojects 로 승격
|
||||
dependencies {
|
||||
implementation 'org.springframework.boot:spring-boot-starter' // spring-core / spring-context (ClassPathResource, @Configuration/@Bean)
|
||||
implementation 'org.springframework.boot:spring-boot-starter-json' // jackson-databind (ConvertUtils)
|
||||
implementation 'org.springframework.boot:spring-boot-starter-jdbc' // spring-jdbc + HikariCP (DataSourceUtil)
|
||||
implementation 'org.springframework.security:spring-security-crypto' // PasswordEncoder / BCrypt (PasswordEncoderConfig)
|
||||
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.2' // SqlSessionFactoryBean (DataSourceUtil)
|
||||
implementation 'commons-codec:commons-codec:1.15' // Aes256Cipher / EncryptConfig
|
||||
implementation 'com.konghq:unirest-java:3.7.02' // kong.unirest.json (ConvertUtils)
|
||||
|
||||
compileOnly 'org.projectlombok:lombok:1.18.20'
|
||||
annotationProcessor 'org.projectlombok:lombok:1.18.20'
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package com.urpsys.baseapi.common.crypto;
|
||||
package com.urpsys.common.crypto;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
@ -16,8 +16,6 @@ import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.codec.binary.Hex;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
|
||||
import com.urpsys.baseapi.common.util.CommonUtil;
|
||||
|
||||
/**
|
||||
* aes 256 암호화 클래스
|
||||
*
|
||||
@ -39,28 +37,42 @@ import com.urpsys.baseapi.common.util.CommonUtil;
|
||||
|
||||
public class Aes256Cipher
|
||||
{
|
||||
// 통합 시 모듈별 키스토어 상이(front=UrpSysKeyMng.keystore, 그 외=UrpSystem.keystore) → 생성자 파라미터화.
|
||||
// 무인자 생성자는 기존 다수 모듈과 동일한 기본값 사용(동작 등가).
|
||||
private static final String DEFAULT_KEYSTORE = "secrets/UrpSystem.keystore";
|
||||
|
||||
private SecretKey keySpec; // keySpec
|
||||
private IvParameterSpec ivSpec; // ivSpec
|
||||
|
||||
/**
|
||||
* Aes256Cipher 생성자
|
||||
* Aes256Cipher 생성자 (기본 키스토어: secrets/UrpSystem.keystore)
|
||||
*
|
||||
* @param keyFile 키 파일 위치를 입력 받음
|
||||
* @throws IOException 파일 io 시 발생하는 익셉션
|
||||
* @throws InvalidKeyException key가 잘못되었을 경우 발생하는 익셉션
|
||||
* @throws DecoderException 암호화된 문자열을 decoding할 때 발생하는 익셉션
|
||||
*/
|
||||
public Aes256Cipher() throws IOException, InvalidKeyException, DecoderException
|
||||
{
|
||||
this(DEFAULT_KEYSTORE);
|
||||
}
|
||||
|
||||
String activeProfile = (CommonUtil.nvl(System.getProperty("spring.profiles.active")));
|
||||
|
||||
/**
|
||||
* Aes256Cipher 생성자
|
||||
*
|
||||
* @param keystoreResource 클래스패스 상의 키스토어 리소스 경로
|
||||
* @throws IOException 파일 io 시 발생하는 익셉션
|
||||
* @throws InvalidKeyException key가 잘못되었을 경우 발생하는 익셉션
|
||||
* @throws DecoderException 암호화된 문자열을 decoding할 때 발생하는 익셉션
|
||||
*/
|
||||
public Aes256Cipher(String keystoreResource) throws IOException, InvalidKeyException, DecoderException
|
||||
{
|
||||
// 기존 무인자 생성자에서 spring.profiles.active 를 조회했으나 이후 미사용(dead) → 제거(동작 등가).
|
||||
InputStream fis = null;
|
||||
String secretKey = null;
|
||||
|
||||
try
|
||||
{
|
||||
fis = new ClassPathResource("secrets/UrpSystem.keystore").getInputStream();
|
||||
fis = new ClassPathResource(keystoreResource).getInputStream();
|
||||
|
||||
Properties props = new Properties();
|
||||
props.load(fis);
|
||||
@ -1,4 +1,4 @@
|
||||
package com.urpsys.kccfbat.common.exception;
|
||||
package com.urpsys.common.exception;
|
||||
|
||||
import java.sql.SQLSyntaxErrorException;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.urpsys.baseapi.common.util;
|
||||
package com.urpsys.common.util;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
@ -1,4 +1,4 @@
|
||||
package com.urpsys.kccfbat.common.util;
|
||||
package com.urpsys.common.util;
|
||||
|
||||
import java.sql.Connection;
|
||||
|
||||
@ -10,8 +10,8 @@ import org.springframework.core.env.Environment;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
|
||||
import com.urpsys.kccfbat.common.crypto.Aes256Cipher;
|
||||
import com.urpsys.kccfbat.common.exception.CustomException;
|
||||
import com.urpsys.common.crypto.Aes256Cipher;
|
||||
import com.urpsys.common.exception.CustomException;
|
||||
import com.zaxxer.hikari.HikariConfig;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
|
||||
@ -28,6 +28,8 @@ ext
|
||||
|
||||
dependencies
|
||||
{
|
||||
implementation project(':common')
|
||||
|
||||
|
||||
implementation 'org.springframework.boot:spring-boot-starter-batch'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-cache'
|
||||
|
||||
@ -1,145 +0,0 @@
|
||||
package com.urpsys.kccfbat.common.crypto;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
import org.apache.commons.codec.DecoderException;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.codec.binary.Hex;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
|
||||
import com.urpsys.kccfbat.common.util.CommonUtil;
|
||||
|
||||
/**
|
||||
* aes 256 암호화 클래스
|
||||
*
|
||||
* @author 나혁제
|
||||
* @since 2023.02.28
|
||||
* @version 1.0.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* << 개정이력(Modification information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ----------- --------- ------------------------
|
||||
* 2023.02.28 나혁제 최초작성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
public class Aes256Cipher
|
||||
{
|
||||
private SecretKey keySpec; // keySpec
|
||||
private IvParameterSpec ivSpec; // ivSpec
|
||||
|
||||
/**
|
||||
* Aes256Cipher 생성자
|
||||
*
|
||||
* @param keyFile 키 파일 위치를 입력 받음
|
||||
* @throws IOException 파일 io 시 발생하는 익셉션
|
||||
* @throws InvalidKeyException key가 잘못되었을 경우 발생하는 익셉션
|
||||
* @throws DecoderException 암호화된 문자열을 decoding할 때 발생하는 익셉션
|
||||
*/
|
||||
public Aes256Cipher() throws IOException, InvalidKeyException, DecoderException
|
||||
{
|
||||
|
||||
String activeProfile = (CommonUtil.nvl(System.getProperty("spring.profiles.active")));
|
||||
|
||||
InputStream fis = null;
|
||||
String secretKey = null;
|
||||
|
||||
try
|
||||
{
|
||||
fis = new ClassPathResource("secrets/UrpSystem.keystore").getInputStream();
|
||||
|
||||
Properties props = new Properties();
|
||||
props.load(fis);
|
||||
secretKey = props.getProperty("aes256.key");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
fis.close();
|
||||
}
|
||||
|
||||
byte[] secretKeyBytes = Hex.decodeHex(secretKey);
|
||||
|
||||
if (secretKeyBytes.length != 32) {
|
||||
throw new InvalidKeyException("Invalid key (key length is not valid) ");
|
||||
}
|
||||
|
||||
byte[] ivBytes = new byte[16];
|
||||
|
||||
System.arraycopy(secretKeyBytes, 0, ivBytes, 0, 16);
|
||||
|
||||
keySpec = new SecretKeySpec(secretKeyBytes, "AES");
|
||||
ivSpec = new IvParameterSpec(ivBytes);
|
||||
}
|
||||
|
||||
/**
|
||||
* encryption 하는 메소드
|
||||
*
|
||||
* @param plainStr 평문을 입력 받음
|
||||
* @return 암호화된 문자열
|
||||
*/
|
||||
public String encrypt(String plainStr)
|
||||
{
|
||||
if (plainStr == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String encryptedStr = null;
|
||||
|
||||
try {
|
||||
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
|
||||
cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec);
|
||||
byte[] encrypted = cipher.doFinal(plainStr.getBytes("UTF-8"));
|
||||
encryptedStr = new String(Base64.encodeBase64(encrypted));
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
return encryptedStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 암호화된 문자열을 복호화하는 메소드
|
||||
*
|
||||
* @param encryptedStr 암호화된 문자열
|
||||
* @return 암호화가 해제된 문자열
|
||||
*/
|
||||
public String decrypt(String encryptedStr)
|
||||
{
|
||||
if (encryptedStr == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
String decryptedStr = null;
|
||||
|
||||
try {
|
||||
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
|
||||
|
||||
cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec);
|
||||
byte[] byteStr = Base64.decodeBase64(encryptedStr.getBytes("UTF-8"));
|
||||
decryptedStr = new String(cipher.doFinal(byteStr), "UTF-8");
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
return decryptedStr;
|
||||
}
|
||||
}
|
||||
@ -23,7 +23,7 @@ import org.springframework.security.oauth2.provider.token.RemoteTokenServices;
|
||||
import com.google.gson.FieldNamingPolicy;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.urpsys.kccfbat.common.exception.CustomException;
|
||||
import com.urpsys.common.exception.CustomException;
|
||||
import com.urpsys.kccfbat.domain.TokenInfo;
|
||||
|
||||
/**
|
||||
|
||||
@ -6,7 +6,7 @@ import org.apache.commons.codec.DecoderException;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import com.urpsys.kccfbat.common.crypto.Aes256Cipher;
|
||||
import com.urpsys.common.crypto.Aes256Cipher;
|
||||
|
||||
/**
|
||||
* 암호화 유틸리티를 등록하는 클래스
|
||||
|
||||
@ -19,7 +19,7 @@ import kong.unirest.JsonNode;
|
||||
import kong.unirest.Unirest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import com.urpsys.kccfbat.common.exception.CustomException;
|
||||
import com.urpsys.common.exception.CustomException;
|
||||
import com.urpsys.kccfbat.domain.CommonVO;
|
||||
import com.urpsys.kccfbat.domain.JWTKey;
|
||||
import com.urpsys.kccfbat.service.CommonService;
|
||||
|
||||
@ -18,9 +18,9 @@ import org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
import com.urpsys.kccfbat.common.crypto.Aes256Cipher;
|
||||
import com.urpsys.kccfbat.common.exception.CustomException;
|
||||
import com.urpsys.kccfbat.common.util.DataSourceUtil;
|
||||
import com.urpsys.common.crypto.Aes256Cipher;
|
||||
import com.urpsys.common.exception.CustomException;
|
||||
import com.urpsys.common.util.DataSourceUtil;
|
||||
|
||||
/**
|
||||
* iams(통합자료관리시스템) db config 클래스
|
||||
|
||||
@ -18,9 +18,9 @@ import org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
import com.urpsys.kccfbat.common.crypto.Aes256Cipher;
|
||||
import com.urpsys.kccfbat.common.exception.CustomException;
|
||||
import com.urpsys.kccfbat.common.util.DataSourceUtil;
|
||||
import com.urpsys.common.crypto.Aes256Cipher;
|
||||
import com.urpsys.common.exception.CustomException;
|
||||
import com.urpsys.common.util.DataSourceUtil;
|
||||
|
||||
/**
|
||||
* ncms(자산관리시스템) db config 클래스
|
||||
|
||||
@ -32,6 +32,8 @@ ext
|
||||
|
||||
dependencies
|
||||
{
|
||||
implementation project(':common')
|
||||
|
||||
|
||||
implementation 'org.springframework.boot:spring-boot-starter-batch'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-cache'
|
||||
|
||||
@ -1,142 +0,0 @@
|
||||
package com.urpsys.basefront.common.crypto;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
import org.apache.commons.codec.DecoderException;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.codec.binary.Hex;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
|
||||
import com.urpsys.basefront.common.util.CommonUtil;
|
||||
|
||||
/**
|
||||
* AES 256 암호화 클래스
|
||||
*
|
||||
* @author urp 인프라본부 나혁제
|
||||
* @since 2025.01.06
|
||||
* @version 1.0.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* << 개정이력(Modification information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ----------- --------- ------------------------
|
||||
* 2025.01.06 나혁제 최초작성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
public class Aes256Cipher
|
||||
{
|
||||
private SecretKey keySpec; // keySpec
|
||||
private IvParameterSpec ivSpec; // ivSpec
|
||||
|
||||
/**
|
||||
* Aes256Cipher 생성자
|
||||
*
|
||||
* @param keyFile 키 파일 위치를 입력 받음
|
||||
* @throws IOException 파일 io 시 발생하는 익셉션
|
||||
* @throws InvalidKeyException key가 잘못되었을 경우 발생하는 익셉션
|
||||
* @throws DecoderException 암호화된 문자열을 decoding할 때 발생하는 익셉션
|
||||
*/
|
||||
public Aes256Cipher() throws IOException, InvalidKeyException, DecoderException {
|
||||
|
||||
String activeProfile = (CommonUtil.nvl(System.getProperty("spring.profiles.active")));
|
||||
|
||||
InputStream fis = null;
|
||||
String secretKey = null;
|
||||
|
||||
try
|
||||
{
|
||||
fis = new ClassPathResource("secrets/UrpSysKeyMng.keystore").getInputStream();
|
||||
|
||||
Properties props = new Properties();
|
||||
props.load(fis);
|
||||
secretKey = props.getProperty("aes256.key");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
fis.close();
|
||||
}
|
||||
|
||||
byte[] secretKeyBytes = Hex.decodeHex(secretKey);
|
||||
|
||||
if (secretKeyBytes.length != 32) {
|
||||
throw new InvalidKeyException("Invalid key (key length is not valid) ");
|
||||
}
|
||||
|
||||
byte[] ivBytes = new byte[16];
|
||||
|
||||
System.arraycopy(secretKeyBytes, 0, ivBytes, 0, 16);
|
||||
|
||||
keySpec = new SecretKeySpec(secretKeyBytes, "AES");
|
||||
ivSpec = new IvParameterSpec(ivBytes);
|
||||
}
|
||||
|
||||
/**
|
||||
* encryption 하는 메소드
|
||||
*
|
||||
* @param plainStr 평문을 입력 받음
|
||||
* @return 암호화된 문자열
|
||||
*/
|
||||
public String encrypt(String plainStr) {
|
||||
if (plainStr == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String encryptedStr = null;
|
||||
|
||||
try {
|
||||
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
|
||||
cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec);
|
||||
byte[] encrypted = cipher.doFinal(plainStr.getBytes("UTF-8"));
|
||||
encryptedStr = new String(Base64.encodeBase64(encrypted));
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
return encryptedStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 암호화된 문자열을 복호화하는 메소드
|
||||
*
|
||||
* @param encryptedStr 암호화된 문자열
|
||||
* @return 암호화가 해제된 문자열
|
||||
*/
|
||||
public String decrypt(String encryptedStr) {
|
||||
if (encryptedStr == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
String decryptedStr = null;
|
||||
|
||||
try {
|
||||
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
|
||||
|
||||
cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec);
|
||||
byte[] byteStr = Base64.decodeBase64(encryptedStr.getBytes("UTF-8"));
|
||||
decryptedStr = new String(cipher.doFinal(byteStr), "UTF-8");
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
return decryptedStr;
|
||||
}
|
||||
}
|
||||
@ -1,115 +0,0 @@
|
||||
package com.urpsys.basefront.common.exception;
|
||||
|
||||
import java.sql.SQLSyntaxErrorException;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* Custom exception 클래스
|
||||
*
|
||||
* @author urp 인프라본부 나혁제
|
||||
* @since 2025.01.06
|
||||
* @version 1.0.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* << 개정이력(Modification information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ----------- --------- ------------------------
|
||||
* 2025.01.06 나혁제 최초작성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
public class CustomException extends Exception
|
||||
{
|
||||
private static final long serialVersionUID = 3559302713942492181L;
|
||||
|
||||
@Getter
|
||||
private String errorCode;
|
||||
|
||||
@Getter
|
||||
private String errorMsg;
|
||||
|
||||
/**
|
||||
* 생성자(throwable를 받아서 exception 종류에 따라 에러 코드 정의하는 클래스)
|
||||
* 에러코드 처리 부분은 향후 db에서 에러코드 읽어와서 매핑하는 것으로
|
||||
* 변경 가능성 있음
|
||||
* @param throwable
|
||||
*/
|
||||
public CustomException(Throwable throwable)
|
||||
{
|
||||
Throwable rootThrowable = getRootCause(throwable);
|
||||
|
||||
// TODO 에러 코드는 상세 정의해서 define 해야 함
|
||||
if(rootThrowable instanceof SQLSyntaxErrorException) {
|
||||
this.errorCode = "100";
|
||||
this.errorMsg = "SQL 오류";
|
||||
} else if(rootThrowable instanceof ArithmeticException) {
|
||||
this.errorCode = "200";
|
||||
this.errorMsg = "연산 오류";
|
||||
} else {
|
||||
this.errorCode = "900";
|
||||
this.errorMsg = "Unknown Error";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 생성자(에러메시지만 받을 경우 에러코드를 0을 default로 세팅)
|
||||
* @param errorMsg
|
||||
*/
|
||||
public CustomException(String errorMsg) {
|
||||
super(errorMsg);
|
||||
this.errorCode = "0";
|
||||
this.errorMsg = errorMsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* 생성자(errorcode, errmsg를 받아 세팅, 소스코드에서 편하게 사용하기 위해
|
||||
* 에러코드를 int 값으로 받으면 string으로 변환하여 저장)
|
||||
* @param errorCode
|
||||
* @param errorMsg
|
||||
*/
|
||||
public CustomException(int errorCode, String errorMsg) {
|
||||
super(errorMsg);
|
||||
this.errorCode = String.valueOf(errorCode);
|
||||
this.errorMsg = errorMsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* 생성자(에러코드, 에러메시지를 받아 세팅)
|
||||
* @param errorCode
|
||||
* @param errorMsg
|
||||
*/
|
||||
public CustomException(String errorCode, String errorMsg) {
|
||||
super(errorMsg);
|
||||
this.errorCode = errorCode;
|
||||
this.errorMsg = errorMsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* stack에서 에러코드 중 root cause를 찾아내는 메소드
|
||||
* @param throwable
|
||||
* @return
|
||||
*/
|
||||
private Throwable getRootCause(Throwable throwable) {
|
||||
Throwable cause = throwable.getCause();
|
||||
|
||||
if (cause == null) {
|
||||
return throwable;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
|
||||
if(cause.getCause() == null) {
|
||||
break;
|
||||
} else {
|
||||
cause = cause.getCause();
|
||||
}
|
||||
}
|
||||
|
||||
return cause;
|
||||
}
|
||||
}
|
||||
@ -20,7 +20,7 @@ import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||
import com.google.gson.FieldNamingPolicy;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.domain.MemberVO;
|
||||
import com.urpsys.basefront.domain.TokenInfo;
|
||||
|
||||
@ -21,7 +21,7 @@ import org.springframework.core.env.Environment;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.urpsys.basefront.common.exception.CustomException;
|
||||
import com.urpsys.common.exception.CustomException;
|
||||
import com.urpsys.basefront.domain.MemberVO;
|
||||
import com.urpsys.basefront.domain.TokenInfo;
|
||||
|
||||
|
||||
@ -1,425 +0,0 @@
|
||||
package com.urpsys.basefront.common.util;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import kong.unirest.json.JSONArray;
|
||||
import kong.unirest.json.JSONException;
|
||||
import kong.unirest.json.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 데이터 유형 변환 처리 모음 Util 클래스
|
||||
*
|
||||
* @author urp 인프라본부 나혁제
|
||||
* @since 2025.01.06
|
||||
* @version 1.0.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* << 개정이력(Modification information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ----------- --------- ------------------------
|
||||
* 2025.01.06 나혁제 최초작성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Slf4j
|
||||
public class ConvertUtils
|
||||
{
|
||||
private ConvertUtils() {}
|
||||
|
||||
/**
|
||||
Object Type을 Map 타입으로 변환처리
|
||||
@version 1.0
|
||||
@author 나혁제
|
||||
@param Object obj
|
||||
@return Map<String, Object>
|
||||
*/
|
||||
public static Map<String, Object> convertToMap(Object obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Objects.isNull(obj))
|
||||
{
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
Map<String, Object> convertMap = new HashMap<>();
|
||||
|
||||
Field[] fields = obj.getClass().getDeclaredFields();
|
||||
|
||||
for (Field field : fields)
|
||||
{
|
||||
field.setAccessible(true);
|
||||
convertMap.put(field.getName(), field.get(obj));
|
||||
}
|
||||
|
||||
return convertMap;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Object Type의 List을 Map List 타입으로 변환처리
|
||||
@version 1.0
|
||||
@author 나혁제
|
||||
@param List<?> list
|
||||
@return List<Map<String, Object>>
|
||||
*/
|
||||
public static List<Map<String, Object>> convertToMaps(List<?> list)
|
||||
{
|
||||
if (list == null || list.isEmpty())
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
List<Map<String, Object>> convertList = new ArrayList<>(list.size());
|
||||
|
||||
for (Object obj : list)
|
||||
{
|
||||
convertList.add(ConvertUtils.convertToMap(obj));
|
||||
}
|
||||
return convertList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Object Type을 Map 타입으로 변환처리 (확장영역까지 변환)
|
||||
@version 1.0
|
||||
@author 나혁제
|
||||
@param Object obj
|
||||
@return Map<String, Object>
|
||||
*/
|
||||
public static Map<String, Object> convertToMapAll(Object obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Objects.isNull(obj))
|
||||
{
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
Class<?> upType = obj.getClass();
|
||||
|
||||
Map<String, Object> convertMap = new HashMap<>();
|
||||
|
||||
while(true)
|
||||
{
|
||||
|
||||
Field[] fields = upType.getDeclaredFields();
|
||||
|
||||
for (Field field : fields)
|
||||
{
|
||||
field.setAccessible(true);
|
||||
convertMap.put(field.getName(), field.get(obj));
|
||||
}
|
||||
|
||||
if(upType.getSuperclass() == null )
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
upType = upType.getSuperclass();
|
||||
}
|
||||
}
|
||||
|
||||
return convertMap;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Map 데이터를 입력괸 클래스 타입으로 변환처리
|
||||
@version 1.0
|
||||
@author 나혁제
|
||||
@param Map<String, Object> map 입력맵
|
||||
Class<T> type 변환 클래스
|
||||
@return <T> T 변환된 븤래스
|
||||
*/
|
||||
public static <T> T convertToValueObject(Map<String, Object> map, Class<T> type)
|
||||
{
|
||||
try
|
||||
{
|
||||
Objects.requireNonNull(type, "Class cannot be null");
|
||||
T instance = type.getConstructor().newInstance();
|
||||
|
||||
if (map == null || map.isEmpty())
|
||||
{
|
||||
return instance;
|
||||
}
|
||||
|
||||
for (Map.Entry<String, Object> entry : map.entrySet())
|
||||
{
|
||||
Field[] fields = type.getDeclaredFields();
|
||||
|
||||
for (Field field : fields)
|
||||
{
|
||||
field.setAccessible(true);
|
||||
String name = field.getName();
|
||||
|
||||
boolean isSameType = entry.getValue().getClass().equals(getReferenceType(field.getType()));
|
||||
boolean isSameName = entry.getKey().equals(name);
|
||||
|
||||
if (isSameType && isSameName)
|
||||
{
|
||||
field.set(instance, map.get(name));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Map List 데이터를 입력괸 클래스 타입으로 변환처리
|
||||
@version 1.0
|
||||
@author 나혁제
|
||||
@param List<Map<String, Object>> list
|
||||
Class<T> type 변환 클래스
|
||||
@return <T> T 변환된 리스트
|
||||
*/
|
||||
public static <T> List<T> convertToValueObjects(List<Map<String, Object>> list, Class<T> type)
|
||||
{
|
||||
Objects.requireNonNull(type, "Class cannot be null");
|
||||
|
||||
if (list == null || list.isEmpty())
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
List<T> convertList = new ArrayList<>(list.size());
|
||||
|
||||
for (Map<String, Object> map : list)
|
||||
{
|
||||
convertList.add(ConvertUtils.convertToValueObject(map, type));
|
||||
}
|
||||
return convertList;
|
||||
}
|
||||
|
||||
/**
|
||||
Map List 데이터를 입력괸 클래스 타입으로 변환처리 (확장영역)
|
||||
@version 1.0
|
||||
@author 나혁제
|
||||
@param Map<String, Object> map 입력맵
|
||||
Class<T> type 변환 클래스
|
||||
@return <T> T 변환된 븤래스
|
||||
*/
|
||||
public static <T> T convertToValueObjectAll(Map<String, Object> map, Class<T> type)
|
||||
{
|
||||
try
|
||||
{
|
||||
Objects.requireNonNull(type, "Class cannot be null");
|
||||
T instance = type.getConstructor().newInstance();
|
||||
|
||||
if (map == null || map.isEmpty())
|
||||
{
|
||||
return instance;
|
||||
}
|
||||
|
||||
for (Map.Entry<String, Object> entry : map.entrySet())
|
||||
{
|
||||
Class<?> upType = type;
|
||||
|
||||
while(true)
|
||||
{
|
||||
Boolean bExist = false;
|
||||
Field[] fields = upType.getDeclaredFields();
|
||||
|
||||
if(fields == null || fields.length==0) break;
|
||||
|
||||
for (Field field : fields)
|
||||
{
|
||||
field.setAccessible(true);
|
||||
String name = field.getName();
|
||||
|
||||
boolean isSameType = entry.getValue().getClass().equals(getReferenceType(field.getType()));
|
||||
boolean isSameName = entry.getKey().equals(name);
|
||||
|
||||
if (isSameType && isSameName)
|
||||
{
|
||||
field.set(instance, map.get(name));
|
||||
bExist = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(bExist) break;
|
||||
|
||||
if(upType.getSuperclass().getClass() == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
upType = upType.getSuperclass();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Map List 데이터를 입력괸 클래스 타입으로 변환처리 (확장된 클래스 처리)
|
||||
@version 1.0
|
||||
@author 나혁제
|
||||
@param v_msg Map
|
||||
@return List<T>
|
||||
*/
|
||||
public static <T> List<T> convertToValueObjectsAll(List<Map<String, Object>> list, Class<T> type)
|
||||
{
|
||||
Objects.requireNonNull(type, "Class cannot be null");
|
||||
|
||||
if (list == null || list.isEmpty())
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
List<T> convertList = new ArrayList<>(list.size());
|
||||
|
||||
for (Map<String, Object> map : list)
|
||||
{
|
||||
convertList.add(ConvertUtils.convertToValueObjectAll(map, type));
|
||||
}
|
||||
return convertList;
|
||||
}
|
||||
|
||||
private static Class<?> getReferenceType(Class<?> type)
|
||||
{
|
||||
switch (type.getName()) {
|
||||
case "boolean" : return Boolean.class;
|
||||
case "byte" : return Byte.class;
|
||||
case "short" : return Short.class;
|
||||
case "char" : return Character.class;
|
||||
case "int" : return Integer.class;
|
||||
case "long" : return Long.class;
|
||||
case "float" : return Float.class;
|
||||
case "double" : return Double.class;
|
||||
default : return type;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Map 데이터를 JSONObject로 변환.
|
||||
@version 1.0
|
||||
@author 나혁제
|
||||
@param v_msg Map
|
||||
@return JSONObject
|
||||
*/
|
||||
public static JSONObject getJsonFromMap(Map<String, Object> map) throws JSONException
|
||||
{
|
||||
JSONObject jsonData = new JSONObject();
|
||||
|
||||
for (String key : map.keySet())
|
||||
{
|
||||
Object value = map.get(key);
|
||||
if (value instanceof Map<?, ?>)
|
||||
{
|
||||
value = getJsonFromMap((Map<String, Object>) value);
|
||||
}
|
||||
jsonData.put(key, value);
|
||||
}
|
||||
return jsonData;
|
||||
}
|
||||
|
||||
/**
|
||||
List 데이터를 JSONArray로 변환.
|
||||
@version 1.0
|
||||
@author 나혁제
|
||||
@param v_msg Map
|
||||
@return JSONObject
|
||||
*/
|
||||
public static JSONArray getJsonFromList(List<Map<String, Object>> list) throws JSONException
|
||||
{
|
||||
|
||||
JSONArray jsonArr = new JSONArray();
|
||||
|
||||
for(Map<String, Object> map : list)
|
||||
{
|
||||
JSONObject jsonObj = getJsonFromMap(map);
|
||||
jsonArr.put(jsonObj);
|
||||
}
|
||||
|
||||
return jsonArr;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* jsonObject --> map 으로 변경
|
||||
* JSONObject 에 JSONArray 없어야 햠.
|
||||
* @author 나혁제
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
public static Map<String, Object> getMapFromJSONObject(JSONObject obj)
|
||||
{
|
||||
if (ObjectUtils.isEmpty(obj))
|
||||
{
|
||||
log.error("BAD REQUEST obj : {}", obj);
|
||||
throw new IllegalArgumentException(String.format("BAD REQUEST obj %s", obj));
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return new ObjectMapper().readValue(obj.toString(), Map.class);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error(e.getMessage(), e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* json array 를 list map 으로 변경.
|
||||
*
|
||||
* @author 나혁제
|
||||
* @param jsonArray
|
||||
* @return 값이 있으면 list map, 없으면 list 빈 값 return
|
||||
*/
|
||||
public static List<Map<String, Object>> getListMapFromJsonArray(JSONArray jsonArray)
|
||||
{
|
||||
if (ObjectUtils.isEmpty(jsonArray))
|
||||
{
|
||||
log.error("jsonArray is null.");
|
||||
throw new IllegalArgumentException("jsonArray is null");
|
||||
}
|
||||
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
|
||||
for (Object jsonObject : jsonArray)
|
||||
{
|
||||
list.add(getMapFromJSONObject((JSONObject) jsonObject));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -23,7 +23,7 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import com.urpsys.basefront.common.crypto.Aes256Cipher;
|
||||
import com.urpsys.common.crypto.Aes256Cipher;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.urpsys.basefront.common.crypto.Aes256Cipher;
|
||||
import com.urpsys.common.crypto.Aes256Cipher;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
|
||||
@ -17,8 +17,8 @@ import org.springframework.core.env.Environment;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.exception.CustomException;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.common.exception.CustomException;
|
||||
import com.urpsys.basefront.domain.MemberVO;
|
||||
import com.urpsys.basefront.domain.TokenInfo;
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ import org.apache.commons.codec.DecoderException;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import com.urpsys.basefront.common.crypto.Aes256Cipher;
|
||||
import com.urpsys.common.crypto.Aes256Cipher;
|
||||
|
||||
/**
|
||||
* 암호화 유틸리티를 등록하는 클래스
|
||||
@ -33,6 +33,6 @@ public class EncryptConfig
|
||||
@Bean(name="aes256Cipher")
|
||||
public Aes256Cipher aes256Cipher() throws InvalidKeyException, IOException, DecoderException
|
||||
{
|
||||
return new Aes256Cipher();
|
||||
return new Aes256Cipher("secrets/UrpSysKeyMng.keystore");
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.urpsys.basefront.common.crypto.Aes256Cipher;
|
||||
import com.urpsys.common.crypto.Aes256Cipher;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.urpsys.basefront.common.exception.CustomException;
|
||||
import com.urpsys.common.exception.CustomException;
|
||||
import com.urpsys.basefront.common.util.CommonUtil;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.domain.MemberVO;
|
||||
|
||||
@ -45,7 +45,7 @@ import com.urpsys.basefront.common.service.CommonService;
|
||||
import com.urpsys.basefront.common.service.GoogleOtpService;
|
||||
import com.urpsys.basefront.common.service.LoginService;
|
||||
import com.urpsys.basefront.common.util.CommonUtil;
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.config.handler.CustomSuccessHandler;
|
||||
import com.urpsys.basefront.domain.MemberVO;
|
||||
|
||||
@ -38,7 +38,7 @@ import com.urpsys.basefront.common.egov.util.EgovStringUtil;
|
||||
import com.urpsys.basefront.common.service.CommonService;
|
||||
import com.urpsys.basefront.common.service.LoginService;
|
||||
import com.urpsys.basefront.common.util.CommonUtil;
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.config.handler.CustomSuccessHandler;
|
||||
import com.urpsys.basefront.domain.MemberVO;
|
||||
|
||||
@ -38,7 +38,7 @@ import com.urpsys.basefront.common.egov.util.EgovStringUtil;
|
||||
import com.urpsys.basefront.common.service.CommonService;
|
||||
import com.urpsys.basefront.common.service.LoginService;
|
||||
import com.urpsys.basefront.common.util.CommonUtil;
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.config.handler.CustomSuccessHandler;
|
||||
import com.urpsys.basefront.domain.MemberVO;
|
||||
|
||||
@ -20,7 +20,7 @@ import com.urpsys.itmsfront.bbs.domain.Comment;
|
||||
import com.urpsys.itmsfront.bbs.domain.CommentVO;
|
||||
import com.urpsys.basefront.common.egov.util.EgovStringUtil;
|
||||
import com.urpsys.basefront.common.service.CommonService;
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.domain.MemberVO;
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ import org.springmodules.validation.commons.DefaultBeanValidator;
|
||||
import com.urpsys.basefront.common.egov.util.EgovDateUtil;
|
||||
import com.urpsys.basefront.common.egov.util.EgovFileMngUtil;
|
||||
import com.urpsys.basefront.common.egov.util.EgovStringUtil;
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.domain.FileVO;
|
||||
import com.urpsys.basefront.domain.MemberVO;
|
||||
|
||||
@ -20,7 +20,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.support.SessionStatus;
|
||||
import org.springmodules.validation.commons.DefaultBeanValidator;
|
||||
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.common.egov.util.EgovStringUtil;
|
||||
import com.urpsys.basefront.common.service.CommonService;
|
||||
|
||||
@ -23,7 +23,7 @@ import com.urpsys.itmsfront.bbs.domain.BoardUseInf;
|
||||
import com.urpsys.itmsfront.bbs.domain.BoardUseInfVO;
|
||||
|
||||
import com.urpsys.basefront.common.egov.util.EgovStringUtil;
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.domain.MemberVO;
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import com.urpsys.basefront.common.egov.util.EgovBrowserUtil;
|
||||
import com.urpsys.basefront.common.egov.util.EgovWebUtil;
|
||||
import com.urpsys.basefront.domain.FileVO;
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import com.urpsys.basefront.domain.FileVO;
|
||||
import com.urpsys.basefront.common.util.CommonUtil;
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import com.urpsys.basefront.domain.ComDefaultVO;
|
||||
import com.urpsys.basefront.domain.FileVO;
|
||||
import com.urpsys.basefront.common.util.CommonUtil;
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@ -18,7 +18,7 @@ import org.codehaus.jettison.json.JSONException;
|
||||
import org.codehaus.jettison.json.JSONObject;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
|
||||
import com.urpsys.basefront.common.exception.CustomException;
|
||||
import com.urpsys.common.exception.CustomException;
|
||||
import com.urpsys.basefront.domain.MemberVO;
|
||||
import com.urpsys.basefront.domain.TokenInfo;
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ import com.urpsys.itmsfront.bbs.domain.BoardVO;
|
||||
import com.urpsys.itmsfront.srm.domain.ReportOtherVo;
|
||||
import com.urpsys.basefront.common.egov.util.EgovStringUtil;
|
||||
import com.urpsys.basefront.common.util.CommonUtil;
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.domain.MemberVO;
|
||||
import com.urpsys.itmsfront.sys.domain.PrsnlPortletCreateVO;
|
||||
|
||||
@ -18,7 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.urpsys.basefront.common.util.CommonUtil;
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.common.egov.util.EgovDateUtil;
|
||||
import com.urpsys.basefront.common.egov.util.EgovFileMngUtil;
|
||||
|
||||
@ -20,7 +20,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
|
||||
import com.urpsys.basefront.common.util.CommonUtil;
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.common.egov.util.EgovDateUtil;
|
||||
import com.urpsys.basefront.common.egov.util.EgovFileMngUtil;
|
||||
|
||||
@ -18,7 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.urpsys.basefront.common.util.CommonUtil;
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.common.egov.util.EgovFileMngUtil;
|
||||
import com.urpsys.basefront.common.service.CommonService;
|
||||
|
||||
@ -38,7 +38,7 @@ import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springmodules.validation.commons.DefaultBeanValidator;
|
||||
|
||||
import com.urpsys.basefront.common.util.CommonUtil;
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.common.egov.util.EgovBrowserUtil;
|
||||
import com.urpsys.basefront.common.egov.util.EgovDateUtil;
|
||||
|
||||
@ -28,7 +28,7 @@ import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springmodules.validation.commons.DefaultBeanValidator;
|
||||
|
||||
import com.urpsys.basefront.common.util.CommonUtil;
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.common.egov.util.EgovDateUtil;
|
||||
import com.urpsys.basefront.common.egov.util.EgovFileMngUtil;
|
||||
|
||||
@ -22,7 +22,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
|
||||
import com.urpsys.basefront.common.util.CommonUtil;
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.common.egov.util.EgovFileMngUtil;
|
||||
import com.urpsys.basefront.common.service.CommonService;
|
||||
|
||||
@ -22,7 +22,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
|
||||
import com.urpsys.basefront.common.util.CommonUtil;
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.common.egov.util.EgovFileMngUtil;
|
||||
import com.urpsys.basefront.common.service.CommonService;
|
||||
|
||||
@ -22,7 +22,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
|
||||
import com.urpsys.basefront.common.util.CommonUtil;
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.common.egov.util.EgovFileMngUtil;
|
||||
import com.urpsys.basefront.common.service.CommonService;
|
||||
|
||||
@ -23,7 +23,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
|
||||
import com.urpsys.basefront.common.util.CommonUtil;
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.common.egov.util.EgovFileMngUtil;
|
||||
import com.urpsys.basefront.common.service.CommonService;
|
||||
|
||||
@ -24,7 +24,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
|
||||
import com.urpsys.basefront.common.util.CommonUtil;
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.common.egov.util.EgovFileMngUtil;
|
||||
import com.urpsys.basefront.common.service.CommonService;
|
||||
|
||||
@ -22,7 +22,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
|
||||
import com.urpsys.basefront.common.util.CommonUtil;
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.common.egov.util.EgovFileMngUtil;
|
||||
import com.urpsys.basefront.common.service.CommonService;
|
||||
|
||||
@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springmodules.validation.commons.DefaultBeanValidator;
|
||||
|
||||
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.config.EgovMessageSource;
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springmodules.validation.commons.DefaultBeanValidator;
|
||||
|
||||
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.config.EgovMessageSource;
|
||||
import com.urpsys.itmsfront.sys.domain.AuthorManage;
|
||||
|
||||
@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springmodules.validation.commons.DefaultBeanValidator;
|
||||
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.config.EgovMessageSource;
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springmodules.validation.commons.DefaultBeanValidator;
|
||||
|
||||
import com.urpsys.basefront.common.egov.util.EgovStringUtil;
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.config.EgovMessageSource;
|
||||
import com.urpsys.basefront.domain.MemberVO;
|
||||
|
||||
@ -19,7 +19,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springmodules.validation.commons.DefaultBeanValidator;
|
||||
|
||||
import com.urpsys.basefront.common.egov.util.EgovStringUtil;
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.config.EgovMessageSource;
|
||||
import com.urpsys.basefront.domain.MemberVO;
|
||||
|
||||
@ -19,7 +19,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springmodules.validation.commons.DefaultBeanValidator;
|
||||
|
||||
import com.urpsys.basefront.common.egov.util.EgovStringUtil;
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.config.EgovMessageSource;
|
||||
import com.urpsys.basefront.domain.MemberVO;
|
||||
|
||||
@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springmodules.validation.commons.DefaultBeanValidator;
|
||||
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.config.EgovMessageSource;
|
||||
import com.urpsys.itmsfront.sys.domain.AuthorManageVO;
|
||||
|
||||
@ -21,7 +21,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springmodules.validation.commons.DefaultBeanValidator;
|
||||
|
||||
import com.urpsys.basefront.common.service.CommonService;
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.config.EgovMessageSource;
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ import org.springmodules.validation.commons.DefaultBeanValidator;
|
||||
|
||||
import com.urpsys.basefront.common.service.CommonService;
|
||||
import com.urpsys.basefront.common.util.CommonUtil;
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
|
||||
import com.urpsys.basefront.config.EgovMessageSource;
|
||||
|
||||
@ -22,7 +22,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import com.urpsys.basefront.common.egov.util.EgovWebUtil;
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.config.EgovMessageSource;
|
||||
import com.urpsys.basefront.domain.TokenInfo;
|
||||
|
||||
@ -19,7 +19,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springmodules.validation.commons.DefaultBeanValidator;
|
||||
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.config.EgovMessageSource;
|
||||
import com.urpsys.itmsfront.sys.domain.MenuManageVO;
|
||||
|
||||
@ -21,7 +21,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springmodules.validation.commons.DefaultBeanValidator;
|
||||
|
||||
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.config.EgovMessageSource;
|
||||
import com.urpsys.basefront.domain.TokenInfo;
|
||||
|
||||
@ -19,7 +19,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springmodules.validation.commons.DefaultBeanValidator;
|
||||
|
||||
import com.urpsys.basefront.common.egov.util.EgovStringUtil;
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.domain.MemberVO;
|
||||
import com.urpsys.itmsfront.sys.domain.PrsnlPortletCreateVO;
|
||||
|
||||
@ -26,7 +26,7 @@ import org.springmodules.validation.commons.DefaultBeanValidator;
|
||||
import com.urpsys.basefront.common.service.CommonService;
|
||||
import com.urpsys.basefront.common.egov.util.EgovStringUtil;
|
||||
import com.urpsys.basefront.common.egov.util.EgovWebUtil;
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.config.EgovMessageSource;
|
||||
import com.urpsys.basefront.domain.MemberVO;
|
||||
|
||||
@ -19,7 +19,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springmodules.validation.commons.DefaultBeanValidator;
|
||||
|
||||
import com.urpsys.basefront.common.service.CommonService;
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.config.EgovMessageSource;
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ import org.springmodules.validation.commons.DefaultBeanValidator;
|
||||
|
||||
import com.urpsys.basefront.common.service.CommonService;
|
||||
import com.urpsys.basefront.common.util.CommonUtil;
|
||||
import com.urpsys.basefront.common.util.ConvertUtils;
|
||||
import com.urpsys.common.util.ConvertUtils;
|
||||
import com.urpsys.basefront.common.util.RestApiCallUtil;
|
||||
import com.urpsys.basefront.config.EgovMessageSource;
|
||||
import com.urpsys.basefront.domain.MemberVO;
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
rootProject.name = 'itms'
|
||||
|
||||
// ITMS 통합 멀티모듈 (INTEGRATION_DESIGN.md §2)
|
||||
// common 모듈은 refactor 단계에서 추가 예정. legacy/nlib(Maven·Java 8)은 Gradle 컴포짓 제외.
|
||||
// common: 공통 클래스 단일화 모듈. legacy/nlib(Maven·Java 8)은 Gradle 컴포짓 제외.
|
||||
include 'common'
|
||||
include 'auth'
|
||||
include 'api'
|
||||
include 'front'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user