diff --git a/pom.xml b/pom.xml
index 93370eb..a0e195d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -196,7 +196,11 @@
-
+
+ * description : properties 암호화 설정 + * packageName : cokr.xit.core.spring.config + * fileName : JasyptConfig + * author : julim + * date : 2024-05-08 + * ====================================================================== + * 변경일 변경자 변경 내용 + * ---------------------------------------------------------------------- + * 2024-05-08 julim 최초 생성 + * + *+ */ +//FIXME :: properties 암호화시 사용 +@Configuration +public class JasyptConfig { + @Value("${app.jasypt.secretKey:none}") + private String secretKey; + + @Value("${app.jasypt.alg:none}") + private String secretAlg; + + @Value("${app.jasypt.type:none}") + private String secretType; + + @Bean(name = "jasyptStringEncryptor") + public StringEncryptor jasyptStringEncryptor() { + SimpleStringPBEConfig config = new SimpleStringPBEConfig(); + // 암/복호화 키 + config.setPassword(secretKey); + // 암/복호화 알고리즘 + config.setAlgorithm(secretAlg); + // 반복할 해싱 회수 + config.setKeyObtentionIterations("1000"); + config.setProviderName("SunJCE"); + // salt 생성 클래스 + config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator"); + // 암/복호화 인스턴스 : 0보다 커야 + config.setPoolSize("1"); + config.setStringOutputType(secretType); + + PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor(); + encryptor.setConfig(config); + return encryptor; + } + +/* + @Bean(name = "jasyptStringEncryptor") + public StringEncryptor jasyptStringEncryptor() { + SimpleStringPBEConfig config = new SimpleStringPBEConfig(); + // 암/복호화 키 + config.setPassword(secretKey); + // 암/복호화 알고리즘 + config.setAlgorithm("PBEWithSHA256And128BitAES-CBC-BC"); + // 반복할 해싱 회수 + config.setKeyObtentionIterations("1000"); + config.setProvider(new BouncyCastleProvider()); + // salt 생성 클래스 + config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator"); + // 암/복호화 인스턴스 : 0보다 커야 + config.setPoolSize("1"); + config.setStringOutputType(secretType); + + PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor(); + encryptor.setConfig(config); + + return encryptor; + } +*/ + + + public static void main(String[] args) { + StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor(); + encryptor.setAlgorithm("PBEWithMD5AndDES"); + encryptor.setPassword("xit5811807!@"); + + String url = encryptor.encrypt("jdbc:log4jdbc:mariadb://211.119.124.9:4407/adds?useUnicode=true&characterEncoding=utf-8&rewriteBatchedStatements=true&autoReconnect=true"); + String id = encryptor.encrypt("addsweb"); + String passwd = encryptor.encrypt("addsweb1234"); + System.out.println(url); + System.out.println(id); + System.out.println(passwd); + System.out.println(encryptor.decrypt(url)); + } + +} diff --git a/src/main/java/cokr/xit/adds/core/spring/config/SpringDocsConfig.java b/src/main/java/cokr/xit/adds/core/spring/config/SpringDocsConfig.java index 83a93f0..8a0540f 100644 --- a/src/main/java/cokr/xit/adds/core/spring/config/SpringDocsConfig.java +++ b/src/main/java/cokr/xit/adds/core/spring/config/SpringDocsConfig.java @@ -25,13 +25,13 @@ public class SpringDocsConfig { private int SERVER_PORT; @Value("${server.http:0}") private int HTTP_PORT; - @Value("${app.swagger-url:}") + @Value("${app.swagger.url:}") private String swaggerUrl; @Bean public OpenAPI openAPI( @Value("${springdoc.version:v1}") String version, - @Value("${app.desc:}") String desc, + @Value("${app.swagger.desc:}") String desc, @Value("${spring.application.name}") String name, @Value("${spring.profiles.active}") String active) { diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index ec83d84..86315bf 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -35,10 +35,13 @@ spring: hikari: driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy #org.mariadb.jdbc.Driver #driver-class-name: org.mariadb.jdbc.Driver - jdbc-url: jdbc:log4jdbc:mariadb://211.119.124.9:4407/adds?useUnicode=true&characterEncoding=utf-8&rewriteBatchedStatements=true&autoReconnect=true #jdbc-url: jdbc:mariadb://211.119.124.9:4407/egov?useUnicode=true&characterEncoding=utf-8&rewriteBatchedStatements=true&autoReconnect=true - username: addsweb - password: addsweb1234 + # jdbc-url: jdbc:log4jdbc:mariadb://211.119.124.9:4407/adds?useUnicode=true&characterEncoding=utf-8&rewriteBatchedStatements=true&autoReconnect=true + # username: addsweb + # password: addsweb1234 + jdbc-url: ENC(O26qFSqrfqMEjEU6jHUqrboYIPpTnwDIHIYQg2ddL0k7VsGvDbAMd/SwDeXjan17CykVLz3Qe++xW+VqxvQpT7/+Kxhl2ry1hTElOPxRHp6OrN/8GyhaScLCcBZgpxNcEAZ3a5qWJKIyLR/+KFk6YpW77lD10jFJvscNNYvFoWQIs/K5eAa/m3JnktX9Ed2RN8ttGgBET5g=) + username: ENC(M4g3XkH/bzupKW2w4WYH3Q==) + password: ENC(fzV0zekJQ7t/QHiz75k+xqdsDUWW6+MY) auto-commit: false # read-only: false @@ -149,6 +152,9 @@ spring: # read-only: false app: + swagger: + url: + desc: 사고마약류폐기지원시스템 log: parameter-enabled: true response-enabled: true diff --git a/src/main/resources/config/application-inf.yml b/src/main/resources/config/application-inf.yml index 4f31b79..e4727c2 100644 --- a/src/main/resources/config/application-inf.yml +++ b/src/main/resources/config/application-inf.yml @@ -15,6 +15,8 @@ app: officeinfo: /api/officeinfo.do placeinfoV1: /api/placeinfo_v1.do reportinfo: /api/reportinfo_ggg.do + mois: + serverId: ADM405000069 iros: url: https://apis.data.go.kr api-key: 0fTkYnZU6XjaAPAp6GzKW9Q6fYq8iaoSH9wKUZwz2PBjRXGM04aUgtO3a61xYGjL8nFZn4fjLGS9XErhMSXq%2Bw%3D%3D diff --git a/src/test/java/cokr/xit/adds/inf/mois/model/ExchangeDtoTest.java b/src/test/java/cokr/xit/adds/inf/mois/model/ExchangeDtoTest.java index 2c944e0..ce228b8 100644 --- a/src/test/java/cokr/xit/adds/inf/mois/model/ExchangeDtoTest.java +++ b/src/test/java/cokr/xit/adds/inf/mois/model/ExchangeDtoTest.java @@ -159,8 +159,6 @@ public class ExchangeDtoTest { mapper.enable(SerializationFeature.INDENT_OUTPUT); mapper.writeValue(sw, dto); - - StringWriter swr = new StringWriter(); mapper.writeValue(swr, dto); System.out.println(swr.toString());