Merge branch 'staging' into main-design
This commit is contained in:
@@ -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");
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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("로그인할 수 없습니다. 관리자에게 문의하세요. (법인 승인대기중)");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -23,5 +23,7 @@ public class PortalProperties {
|
||||
|
||||
private int authTtl = 300; // 인증번호 만료시간, 초단위
|
||||
|
||||
private String authVirtualCode = "";
|
||||
|
||||
private Map<RoleCode, List<String>> portalSecurity;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
@@ -34,6 +34,9 @@ gateway:
|
||||
username: AGWAPP
|
||||
password: AGWAPP123!
|
||||
|
||||
portal:
|
||||
auth-virtual-code: 654321
|
||||
|
||||
proxy:
|
||||
targets:
|
||||
stg: http://localhost:10000/monitoring
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -24,6 +24,9 @@ ems:
|
||||
password: EMSAPP123!
|
||||
schema: EMSADM
|
||||
|
||||
portal:
|
||||
auth-virtual-code: 654321
|
||||
|
||||
gateway:
|
||||
datasource:
|
||||
serverName: 192.168.240.177
|
||||
|
||||
@@ -52,6 +52,7 @@ sample-code-path: classpath:/templates/sample_code
|
||||
|
||||
portal:
|
||||
auth-ttl: 300
|
||||
|
||||
user-approval: true
|
||||
password-expiration-days: 90
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<configuration>
|
||||
<configuration scan="true" scanPeriod="5 seconds">
|
||||
<property name="LOG_PATH" value="/Log/App/eapim/${inst.Name:-devSvr00}"/>
|
||||
<property name="LOG_FILE" value="${LOG_PATH}/portal.log"/>
|
||||
<property name="CONSOLE_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} %magenta([%thread]) %highlight([%-3level]) %logger{5} - %msg %n" />
|
||||
<!-- <property name="CONSOLE_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} %magenta([%thread]) %highlight([%-3level]) %logger{5} - %msg %n" />-->
|
||||
<property name="CONSOLE_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} %magenta([%thread]) %highlight([%-3level]) %logger - %msg %n" />
|
||||
|
||||
|
||||
<appender name="ROLLING" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_FILE}</file>
|
||||
<file>${LOG_PATH}/portal.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_PATH}/portal.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<maxHistory>7</maxHistory>
|
||||
@@ -16,9 +16,7 @@
|
||||
</appender>
|
||||
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<Pattern>${CONSOLE_PATTERN}</Pattern>
|
||||
</encoder>
|
||||
<encoder><Pattern>${CONSOLE_PATTERN}</Pattern></encoder>
|
||||
</appender>
|
||||
|
||||
|
||||
@@ -27,25 +25,72 @@
|
||||
<appender-ref ref="ROLLING"/>
|
||||
</root>
|
||||
|
||||
|
||||
<springProfile name="stage">
|
||||
<springProfile name="dev">
|
||||
<root level="DEBUG">
|
||||
<appender-ref ref="ROLLING"/>
|
||||
</root>
|
||||
</springProfile>
|
||||
|
||||
<springProfile name="dev,gf63">
|
||||
<logger name="org.springframework" level="WARN" additivity="false"/>
|
||||
<logger name="org.hibernate" level="INFO" additivity="false"/>
|
||||
<logger name="org.apache" level="INFO" additivity="false"/>
|
||||
<logger name="sun.rmi" level="WARN" additivity="false"/>
|
||||
<logger name="javax" level="WARN" additivity="false"/>
|
||||
<logger name="jdk.event.security" level="WARN" additivity="false"/>
|
||||
<springProfile name="stage">
|
||||
<root level="INFO">
|
||||
<appender-ref ref="ROLLING"/>
|
||||
</root>
|
||||
</springProfile>
|
||||
|
||||
|
||||
<springProfile name="gf63">
|
||||
<property name="LOG_PATH" value="d:/kjb-logs/${inst.Name:-devSvr00}"/>
|
||||
|
||||
<appender name="HIBERNATE_APPENDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_PATH}/hibernate.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_PATH}/hibernate.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<maxHistory>7</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<appender name="ROLLING" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_PATH}/portal.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_PATH}/portal.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<maxHistory>7</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
|
||||
<logger name="sun.rmi" level="INFO" additivity="false"/>
|
||||
|
||||
<logger name="javax" level="INFO" additivity="false"/>
|
||||
|
||||
<logger name="jdk.event.security" level="INFO" additivity="false"/>
|
||||
|
||||
<logger name="com.zaxxer.hikari" level="INFO" additivity="false"/>
|
||||
<logger name="_org.springframework.web" level="INFO" additivity="false"/>
|
||||
<logger name="com.atomikos" level="INFO" additivity="false"/>
|
||||
|
||||
<root level="DEBUG">
|
||||
<logger name="org.apache" level="INFO" additivity="false"/>
|
||||
<logger name="org.codehaus.groovy.vmplugin.VMPluginFactory" level="INFO" additivity="false"/>
|
||||
<!-- <logger name="org.hibernate" level="INFO" additivity="false"/>-->
|
||||
<logger name="org.thymeleaf.TemplateEngine" level="INFO" additivity="false"/>
|
||||
<logger name="org.springframework" level="INFO" additivity="false"/>
|
||||
<logger name="_org.springframework.web" level="INFO" additivity="false"/>
|
||||
|
||||
|
||||
<logger name="org.hibernate.SQL" level="DEBUG" additivity="false">
|
||||
<appender-ref ref="HIBERNATE_APPENDER" />
|
||||
</logger>
|
||||
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE" additivity="false">
|
||||
<appender-ref ref="HIBERNATE_APPENDER" />
|
||||
</logger>
|
||||
<logger name="ccom.eactive.eapim" level="DEBUG" additivity="false"/>
|
||||
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="ROLLING"/>
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</root>
|
||||
|
||||
Reference in New Issue
Block a user