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/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/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/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/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..d195e96 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,10 @@ public class PortalConfigPortalDatasource { log.error("Profile property 'schema' is empty. Please check your configuration."); throw new IllegalArgumentException("'ems.datasource.schema' is not configured."); } + + + // EMS 파라미터와 호환되도록 프로퍼티 명칭 설정 + System.setProperty("eai.tableowner", emsDatasourceProperties.getSchema()); } @Primary @@ -126,7 +130,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/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 new file mode 100644 index 0000000..2be694d --- /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.KjbSafedbWrapper; +import org.springframework.security.crypto.password.PasswordEncoder; + +public class KjbPasswordEncoder implements PasswordEncoder { + @Override + public String encode(CharSequence rawPassword) { + KjbSafedbWrapper safedb = KjbSafedbWrapper.getInstance(); + return safedb.encryptPassword(rawPassword.toString()); + } + + @Override + public boolean matches(CharSequence rawPassword, String encodedPassword) { + 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..2b27b6b 100644 --- a/src/main/resources/application-gf63.yml +++ b/src/main/resources/application-gf63.yml @@ -1,10 +1,12 @@ +server.port: '30200' + spring: jta: enabled: true jpa: properties: hibernate: - show_sql: true + show_sql: false format_sql: true use_sql_comments: true devtools: @@ -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 d075bcf..64bf7dd 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 @@ -16,9 +16,7 @@ - - ${CONSOLE_PATTERN} - + ${CONSOLE_PATTERN} @@ -27,25 +25,72 @@ - - + - - - - - - - + + + + + + + + + + + + ${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 + + + + + + + + + + - - + + + + + + + + + + + + + + + + + +