kjb-safedb 적용, 휴대폰 인증 개발용 설정 추가, 로깅 설정 일부 변경

This commit is contained in:
Rinjae
2025-09-29 18:33:58 +09:00
parent 050ec17a7f
commit 696350f8f3
11 changed files with 53 additions and 79 deletions
@@ -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");
// }
}
@@ -23,5 +23,7 @@ public class PortalProperties {
private int authTtl = 300; // 인증번호 만료시간, 초단위
private String authVirtualCode = "";
private Map<RoleCode, List<String>> portalSecurity;
}
@@ -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);
}
}