From 050ec17a7fc9329b12619e46f083ada4ab5a54d0 Mon Sep 17 00:00:00 2001 From: Rinjae Date: Wed, 24 Sep 2025 17:48:39 +0900 Subject: [PATCH 1/4] =?UTF-8?q?=EA=B4=91=EC=A3=BC=EC=9D=80=ED=96=89=20?= =?UTF-8?q?=EC=A0=84=EC=9A=A9=20password=20encoder=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 11 ++++ .../portal/config/PasswordEncoderConfig.java | 4 +- .../custom/config/KjbPasswordEncoder.java | 19 +++++++ src/main/resources/logback-spring.xml | 50 ++++++++++++++----- 4 files changed, 70 insertions(+), 14 deletions(-) create mode 100644 src/main/java/com/eactive/apim/portal/custom/config/KjbPasswordEncoder.java diff --git a/build.gradle b/build.gradle index 86d76b8..e1b77c8 100644 --- a/build.gradle +++ b/build.gradle @@ -146,4 +146,15 @@ war { from('src/main/resources/jeus-web-dd.xml') { into 'WEB-INF' } from('src/main/resources/weblogic.xml') { into 'WEB-INF' } +} + +task printSourceSets { + doLast { + sourceSets.each { srcSet -> + println "SourceSet: ${srcSet.name}" + println " Java srcDirs : ${srcSet.allJava.srcDirs}" + println " Resources : ${srcSet.resources.srcDirs}" + println " Output dir : ${srcSet.output.classesDirs.asPath}" + } + } } \ No newline at end of file diff --git a/src/main/java/com/eactive/apim/portal/config/PasswordEncoderConfig.java b/src/main/java/com/eactive/apim/portal/config/PasswordEncoderConfig.java index fc96d69..8e77a31 100644 --- a/src/main/java/com/eactive/apim/portal/config/PasswordEncoderConfig.java +++ b/src/main/java/com/eactive/apim/portal/config/PasswordEncoderConfig.java @@ -1,5 +1,6 @@ package com.eactive.apim.portal.config; +import com.eactive.apim.portal.custom.config.KjbPasswordEncoder; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.crypto.password.PasswordEncoder; @@ -10,6 +11,7 @@ public class PasswordEncoderConfig { @Bean public PasswordEncoder passwordEncoder() { - return new StandardPasswordEncoder(); +// return new StandardPasswordEncoder(); + return new KjbPasswordEncoder(); } } diff --git a/src/main/java/com/eactive/apim/portal/custom/config/KjbPasswordEncoder.java b/src/main/java/com/eactive/apim/portal/custom/config/KjbPasswordEncoder.java new file mode 100644 index 0000000..1f3bff0 --- /dev/null +++ b/src/main/java/com/eactive/apim/portal/custom/config/KjbPasswordEncoder.java @@ -0,0 +1,19 @@ +package com.eactive.apim.portal.custom.config; + +import com.eactive.ext.kjb.safedb.SafeDBWrapper; +import org.springframework.security.crypto.password.PasswordEncoder; + +public class KjbPasswordEncoder implements PasswordEncoder { + @Override + public String encode(CharSequence rawPassword) { + SafeDBWrapper safedb = SafeDBWrapper.getInstance(); + return safedb.encryptPswd(rawPassword.toString()); + } + + @Override + public boolean matches(CharSequence rawPassword, String encodedPassword) { + SafeDBWrapper safedb = SafeDBWrapper.getInstance(); + String encoded = safedb.encryptPswd(rawPassword.toString()); + return encoded.equals(encodedPassword); + } +} diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index d075bcf..60fdd20 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -1,11 +1,11 @@ - + - - + + - ${LOG_FILE} + ${LOG_PATH}/portal.log ${LOG_PATH}/portal.%d{yyyy-MM-dd}.log 7 @@ -15,12 +15,21 @@ - + + ${LOG_PATH}/hibernate.log + + ${LOG_PATH}/hibernate.%d{yyyy-MM-dd}.log + 7 + - ${CONSOLE_PATTERN} + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n + + ${CONSOLE_PATTERN} + + @@ -35,16 +44,31 @@ - - - - - - + + + + + + - + + + + + + + + + + + + + + + + From 696350f8f3fe70d2ee43f77aa847900f79438054 Mon Sep 17 00:00:00 2001 From: Rinjae Date: Mon, 29 Sep 2025 18:33:58 +0900 Subject: [PATCH 2/4] =?UTF-8?q?kjb-safedb=20=EC=A0=81=EC=9A=A9,=20?= =?UTF-8?q?=ED=9C=B4=EB=8C=80=ED=8F=B0=20=EC=9D=B8=EC=A6=9D=20=EA=B0=9C?= =?UTF-8?q?=EB=B0=9C=EC=9A=A9=20=EC=84=A4=EC=A0=95=20=EC=B6=94=EA=B0=80,?= =?UTF-8?q?=20=EB=A1=9C=EA=B9=85=20=EC=84=A4=EC=A0=95=20=EC=9D=BC=EB=B6=80?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 4 ++ settings.gradle | 4 ++ .../auth/service/AuthNumberGenerator.java | 28 +++++---- .../apim/portal/config/PortalProperties.java | 2 + .../custom/config/KjbPasswordEncoder.java | 10 ++-- src/main/resources/application-apipod01.yml | 58 ------------------- src/main/resources/application-dev.yml | 3 + src/main/resources/application-gf63.yml | 4 ++ src/main/resources/application-stage.yml | 3 + src/main/resources/application.yml | 1 + src/main/resources/logback-spring.xml | 15 +++-- 11 files changed, 53 insertions(+), 79 deletions(-) delete mode 100644 src/main/resources/application-apipod01.yml diff --git a/.gitignore b/.gitignore index afbd3b9..17e8cca 100644 --- a/.gitignore +++ b/.gitignore @@ -97,3 +97,7 @@ TODO.txt *.zip /src/docs/ /docs/ + + +*.lck +*.log diff --git a/settings.gradle b/settings.gradle index 330c133..43bae24 100644 --- a/settings.gradle +++ b/settings.gradle @@ -5,3 +5,7 @@ include 'elink-portal-common' project (':elink-online-core-jpa').projectDir = new File(settingsDir, "../eapim-online/elink-online-core-jpa") project (':elink-portal-common').projectDir = new File(settingsDir, "../elink-portal-common") + + +include 'kjb-safedb' +project (':kjb-safedb').projectDir = new File(settingsDir, "../kjb-safedb") \ No newline at end of file diff --git a/src/main/java/com/eactive/apim/portal/apps/auth/service/AuthNumberGenerator.java b/src/main/java/com/eactive/apim/portal/apps/auth/service/AuthNumberGenerator.java index f7cc450..59c9bca 100644 --- a/src/main/java/com/eactive/apim/portal/apps/auth/service/AuthNumberGenerator.java +++ b/src/main/java/com/eactive/apim/portal/apps/auth/service/AuthNumberGenerator.java @@ -1,30 +1,34 @@ package com.eactive.apim.portal.apps.auth.service; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.core.env.Environment; +import com.eactive.apim.portal.config.PortalProperties; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; +import org.springframework.util.StringUtils; import java.security.SecureRandom; -import java.util.Arrays; @Component +@Slf4j public class AuthNumberGenerator { - private final Environment env; + private final PortalProperties portalProperties; - @Autowired - public AuthNumberGenerator(Environment env) { - this.env = env; + + public AuthNumberGenerator(PortalProperties portalProperties) { + this.portalProperties = portalProperties; } + public String generateAuthNumber() { - if (isDevProfile()) { - return "123456"; + if (StringUtils.hasLength(portalProperties.getAuthVirtualCode())) { + log.info("가상 인증코드 활성화 상태 - {}", portalProperties.getAuthVirtualCode()); + return portalProperties.getAuthVirtualCode(); } + SecureRandom rand = new SecureRandom(); return String.format("%06d", 100000 + rand.nextInt(900000)); } - private boolean isDevProfile() { - return Arrays.asList(env.getActiveProfiles()).contains("dev"); - } +// private boolean isDevProfile() { +// return Arrays.asList(env.getActiveProfiles()).contains("dev"); +// } } diff --git a/src/main/java/com/eactive/apim/portal/config/PortalProperties.java b/src/main/java/com/eactive/apim/portal/config/PortalProperties.java index dc99536..51beca9 100644 --- a/src/main/java/com/eactive/apim/portal/config/PortalProperties.java +++ b/src/main/java/com/eactive/apim/portal/config/PortalProperties.java @@ -23,5 +23,7 @@ public class PortalProperties { private int authTtl = 300; // 인증번호 만료시간, 초단위 + private String authVirtualCode = ""; + private Map> portalSecurity; } diff --git a/src/main/java/com/eactive/apim/portal/custom/config/KjbPasswordEncoder.java b/src/main/java/com/eactive/apim/portal/custom/config/KjbPasswordEncoder.java index 1f3bff0..2be694d 100644 --- a/src/main/java/com/eactive/apim/portal/custom/config/KjbPasswordEncoder.java +++ b/src/main/java/com/eactive/apim/portal/custom/config/KjbPasswordEncoder.java @@ -1,19 +1,19 @@ package com.eactive.apim.portal.custom.config; -import com.eactive.ext.kjb.safedb.SafeDBWrapper; +import com.eactive.ext.kjb.safedb.KjbSafedbWrapper; import org.springframework.security.crypto.password.PasswordEncoder; public class KjbPasswordEncoder implements PasswordEncoder { @Override public String encode(CharSequence rawPassword) { - SafeDBWrapper safedb = SafeDBWrapper.getInstance(); - return safedb.encryptPswd(rawPassword.toString()); + KjbSafedbWrapper safedb = KjbSafedbWrapper.getInstance(); + return safedb.encryptPassword(rawPassword.toString()); } @Override public boolean matches(CharSequence rawPassword, String encodedPassword) { - SafeDBWrapper safedb = SafeDBWrapper.getInstance(); - String encoded = safedb.encryptPswd(rawPassword.toString()); + KjbSafedbWrapper safedb = KjbSafedbWrapper.getInstance(); + String encoded = safedb.encryptPassword(rawPassword.toString()); return encoded.equals(encodedPassword); } } diff --git a/src/main/resources/application-apipod01.yml b/src/main/resources/application-apipod01.yml deleted file mode 100644 index be77f8d..0000000 --- a/src/main/resources/application-apipod01.yml +++ /dev/null @@ -1,58 +0,0 @@ -spring: - jta: - enabled: true - - - jpa: - properties: - hibernate: - show_sql: true - format_sql: true - use_sql_comments: true - devtools: - restart: - enabled: false - livereload: - enabled: true - thymeleaf: - cache: false - -ems: - datasource: - serverName: 192.168.240.177 - portNumber: 3306 - databaseName: apims - username: apims - password: apims - -# serverName: 172.20.160.59 -# portNumber: 3317 -# databaseName: ndapims -# username: api_app -# password: Tapiapp*17 - -gateway: - datasource: - serverName: 192.168.240.177 - portNumber: 3306 - databaseName: apigw - username: apigw - password: apigw - -# serverName: 172.20.160.59 -# portNumber: 3317 -# databaseName: ndapigw -# username: api_app -# password: Tapiapp*17 - - -proxy: - targets: - stg: http://localhost:10000/monitoring - prod: http://localhost:10000/monitoring - - # stg: http://inter-ndapiap01.k-bank.com:7090/monitoring - # prod: http://inter-ndapiap01.k-bank.com:7090/monitoring - timeout: - connect: 5000 - read: 5000 diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index cc482c1..cb8bb91 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -34,6 +34,9 @@ gateway: username: AGWAPP password: AGWAPP123! +portal: + auth-virtual-code: 654321 + proxy: targets: stg: http://localhost:10000/monitoring diff --git a/src/main/resources/application-gf63.yml b/src/main/resources/application-gf63.yml index 2a8eeaf..d1f7b7e 100644 --- a/src/main/resources/application-gf63.yml +++ b/src/main/resources/application-gf63.yml @@ -1,3 +1,5 @@ +server.port: '30200' + spring: jta: enabled: true @@ -33,6 +35,8 @@ gateway: password: AGWAPP123! schema: AGWADM +portal: + auth-virtual-code: 654321 proxy: targets: diff --git a/src/main/resources/application-stage.yml b/src/main/resources/application-stage.yml index 5312d47..62aca9a 100644 --- a/src/main/resources/application-stage.yml +++ b/src/main/resources/application-stage.yml @@ -24,6 +24,9 @@ ems: password: EMSAPP123! schema: EMSADM +portal: + auth-virtual-code: 654321 + gateway: datasource: serverName: 192.168.240.177 diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 1005670..aa74b84 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -52,6 +52,7 @@ sample-code-path: classpath:/templates/sample_code portal: auth-ttl: 300 + user-approval: true password-expiration-days: 90 diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index 60fdd20..5f10942 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -36,14 +36,21 @@ - - + - + + + + + + + + + @@ -69,7 +76,7 @@ - + From a095ee7819d188956c97414fab1d05960476063e Mon Sep 17 00:00:00 2001 From: Rinjae Date: Tue, 30 Sep 2025 13:12:56 +0900 Subject: [PATCH 3/4] =?UTF-8?q?=EB=A1=9C=EA=B9=85=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/PortalAuthenticationManager.java | 10 +++--- .../config/PortalConfigPortalDatasource.java | 4 ++- src/main/resources/application-gf63.yml | 2 +- src/main/resources/logback-spring.xml | 36 +++++++++++++------ 4 files changed, 35 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/eactive/apim/portal/config/PortalAuthenticationManager.java b/src/main/java/com/eactive/apim/portal/config/PortalAuthenticationManager.java index e089e85..138effb 100644 --- a/src/main/java/com/eactive/apim/portal/config/PortalAuthenticationManager.java +++ b/src/main/java/com/eactive/apim/portal/config/PortalAuthenticationManager.java @@ -5,10 +5,8 @@ import com.eactive.apim.portal.apps.user.service.PortalUserAuthService; import com.eactive.apim.portal.common.user.PortalAuthenticatedUser; import com.eactive.apim.portal.portalorg.entity.PortalOrgEnums; import com.eactive.apim.portal.portaluser.entity.PortalUserEnums; - -import java.util.Base64; - import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.security.authentication.*; import org.springframework.security.core.Authentication; import org.springframework.security.core.AuthenticationException; @@ -17,9 +15,12 @@ import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.Base64; + @Service @Transactional @RequiredArgsConstructor +@Slf4j public class PortalAuthenticationManager implements AuthenticationManager { private final PortalUserAuthService portalUserAuthService; @@ -73,7 +74,8 @@ public class PortalAuthenticationManager implements AuthenticationManager { if (user.getPortalOrg() != null) { if (!user.getPortalOrg().getApprovalStatus().equals(PortalOrgEnums.ApprovalStatus.COMPLETED)) { - throw new DisabledException("로그인할 수 없습니다. 관리자에게 문의하세요."); + log.debug("기업사용자 - getApprovalStatus : {} / - org.approvalStatus : {}", user.getApprovalStatus(), user.getPortalOrg().getApprovalStatus()); + throw new DisabledException("로그인할 수 없습니다. 관리자에게 문의하세요. (법인 승인대기중)"); } } diff --git a/src/main/java/com/eactive/apim/portal/config/PortalConfigPortalDatasource.java b/src/main/java/com/eactive/apim/portal/config/PortalConfigPortalDatasource.java index 265bd60..11c8552 100644 --- a/src/main/java/com/eactive/apim/portal/config/PortalConfigPortalDatasource.java +++ b/src/main/java/com/eactive/apim/portal/config/PortalConfigPortalDatasource.java @@ -59,6 +59,8 @@ public class PortalConfigPortalDatasource { log.error("Profile property 'schema' is empty. Please check your configuration."); throw new IllegalArgumentException("'ems.datasource.schema' is not configured."); } + + System.setProperty("ems.schema", emsDatasourceProperties.getSchema()); } @Primary @@ -126,7 +128,7 @@ public class PortalConfigPortalDatasource { properties.put("hibernate.dialect", "org.hibernate.dialect.Oracle12cDialect"); properties.put("hibernate.format_sql", "true"); properties.put("hibernate.physical_naming_strategy", "com.eactive.apim.portal.common.entity.CustomPhysicalNamingStrategy"); - properties.put("hibernate.show_sql", "true"); +// properties.put("hibernate.show_sql", "true"); properties.put("hibernate.transaction.jta.platform", "org.hibernate.engine.transaction.jta.platform.internal.AtomikosJtaPlatform"); properties.put("hibernate.use_sql_comments", "true"); properties.put("hibernate.default_schema", emsDatasourceProperties.getSchema()); diff --git a/src/main/resources/application-gf63.yml b/src/main/resources/application-gf63.yml index d1f7b7e..2b27b6b 100644 --- a/src/main/resources/application-gf63.yml +++ b/src/main/resources/application-gf63.yml @@ -6,7 +6,7 @@ spring: jpa: properties: hibernate: - show_sql: true + show_sql: false format_sql: true use_sql_comments: true devtools: diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index 5f10942..64bf7dd 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -15,17 +15,6 @@ - - ${LOG_PATH}/hibernate.log - - ${LOG_PATH}/hibernate.%d{yyyy-MM-dd}.log - 7 - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n - - - ${CONSOLE_PATTERN} @@ -48,9 +37,33 @@ + + + ${LOG_PATH}/hibernate.log + + ${LOG_PATH}/hibernate.%d{yyyy-MM-dd}.log + 7 + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n + + + + + ${LOG_PATH}/portal.log + + ${LOG_PATH}/portal.%d{yyyy-MM-dd}.log + 7 + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n + + + + @@ -74,6 +87,7 @@ + From aae49583ddf7353716f064b5cb4335b0a76d049f Mon Sep 17 00:00:00 2001 From: Rinjae Date: Tue, 30 Sep 2025 15:37:23 +0900 Subject: [PATCH 4/4] =?UTF-8?q?ems=20=EC=99=80=20=EC=8A=A4=ED=82=A4?= =?UTF-8?q?=EB=A7=88=20property=20=EC=9D=BC=EC=B9=98=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../apim/portal/config/PortalConfigPortalDatasource.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/eactive/apim/portal/config/PortalConfigPortalDatasource.java b/src/main/java/com/eactive/apim/portal/config/PortalConfigPortalDatasource.java index 11c8552..d195e96 100644 --- a/src/main/java/com/eactive/apim/portal/config/PortalConfigPortalDatasource.java +++ b/src/main/java/com/eactive/apim/portal/config/PortalConfigPortalDatasource.java @@ -60,7 +60,9 @@ public class PortalConfigPortalDatasource { throw new IllegalArgumentException("'ems.datasource.schema' is not configured."); } - System.setProperty("ems.schema", emsDatasourceProperties.getSchema()); + + // EMS 파라미터와 호환되도록 프로퍼티 명칭 설정 + System.setProperty("eai.tableowner", emsDatasourceProperties.getSchema()); } @Primary