Merge remote-tracking branch 'origin/staging' of C:/eactive/workspaces/eapim-git/bundles/250930/elink-portal-common_incremental_2025-09-22.bundle into staging

# Conflicts:
#	build.gradle
#	src/main/java/com/eactive/ext/kjb/safedb/SafeDBFaker.java
#	src/main/java/com/eactive/ext/kjb/safedb/SafeDBWrapper.java
#	src/main/java/kjb/safedb/KjbNotRnnoJpaAttributeConverter.java
#	src/test/java/com/eactive/ext/kjb/safedb/test/SafeDbWrapperTest.java
This commit is contained in:
Rinjae
2025-09-30 17:46:51 +09:00
8 changed files with 37 additions and 164 deletions
+6 -6
View File
@@ -71,7 +71,6 @@ local.properties
.idea
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
*.iml
# User-specific stuff
.idea/**/workspace.xml
@@ -100,11 +99,11 @@ local.properties
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
.idea/modules.xml
.idea/*.iml
.idea/modules
*.iml
*.ipr
# CMake
cmake-build-*/
@@ -230,3 +229,4 @@ gradle-app.setting
# End of https://www.gitignore.io/api/java,macos,gradle,intellij
/EAISIMWeb/
elink-portal-common.iml
+1 -5
View File
@@ -22,7 +22,6 @@ def hibernateVersion = "5.6.15.Final"
def generatedJavaDir = "$buildDir/generated/java"
def generatedTestJavaDir = "$buildDir/generated-test/java"
java {
toolchain {
languageVersion = JavaLanguageVersion.of(8)
@@ -73,6 +72,7 @@ tasks.withType(JavaCompile) {
}
dependencies {
api project(':kjb-safedb')
api "com.querydsl:querydsl-jpa:${queryDslVersion}"
api "com.querydsl:querydsl-apt:${queryDslVersion}"
@@ -117,10 +117,6 @@ dependencies {
testRuntimeOnly 'com.h2database:h2:2.1.214'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.8.2'
// 광주은행 safedb 용 임시 라이브러리
compileOnly(fileTree(dir: "ext-libs/safedb", include: ["*.jar"]))
}
test {
@@ -5,14 +5,15 @@ import com.eactive.apim.portal.portalorg.entity.PortalOrg;
import com.eactive.apim.portal.portaluser.entity.PortalUserEnums.ApprovalStatus;
import com.eactive.apim.portal.portaluser.entity.PortalUserEnums.RoleCode;
import com.eactive.apim.portal.portaluser.entity.PortalUserEnums.UserStatus;
import com.eactive.ext.kjb.safedb.SafeDBMNotRnnoConverter;
import java.io.Serializable;
import kjb.safedb.KjbNotRnnoJpaAttributeConverter;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Comment;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;
@Data
@@ -31,7 +32,7 @@ public class PortalUser extends Auditable implements Serializable, com.eactive.e
@Column(name = "login_id", length = 200, nullable = false)
@Comment("로그인ID")
@Convert(converter = SafeDBMNotRnnoConverter.class)
@Convert(converter = KjbNotRnnoJpaAttributeConverter.class)
private String loginId;
@Column(name = "password_hash", length = 60)
@@ -44,17 +45,17 @@ public class PortalUser extends Auditable implements Serializable, com.eactive.e
@Column(name = "phone_number", length = 50)
@Comment("전화번호")
@Convert(converter = SafeDBMNotRnnoConverter.class)
@Convert(converter = KjbNotRnnoJpaAttributeConverter.class)
private String phoneNumber;
@Column(name = "mobile_number", length = 50)
@Comment("휴대폰 번호")
@Convert(converter = SafeDBMNotRnnoConverter.class)
@Convert(converter = KjbNotRnnoJpaAttributeConverter.class)
private String mobileNumber;
@Column(name = "email_addr", length = 200)
@Comment("이메일주소")
@Convert(converter = SafeDBMNotRnnoConverter.class)
@Convert(converter = KjbNotRnnoJpaAttributeConverter.class)
private String emailAddr;
@ManyToOne(fetch = FetchType.EAGER)
@@ -1,19 +0,0 @@
package com.eactive.ext.kjb.safedb;
import java.lang.reflect.InvocationTargetException;
public abstract class SafeDBBroker extends SafeDBFaker{
private Object instance;
protected void initialize() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
Class<?> clazz = Class.forName("com.initech.safedb.SimpleSafeDB");
instance = clazz.getMethod("getInstance").invoke(null);
}
protected Object methodInvoke(String methodName, Class<?>[] paramTypes, Object[] params) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
if (instance == null) {
throw new IllegalStateException("SafeDBBroker is not initialized.");
}
return instance.getClass().getMethod(methodName, paramTypes).invoke(instance, params);
}
}
@@ -1,51 +0,0 @@
package com.eactive.ext.kjb.safedb;
public enum SafeDBColumns {
RNNO("RNNO"),
PSWD("PSWD"),
NOT_RNNO("NOT_RNNO"),;
private final String value;
SafeDBColumns (String value) {
this.value = value;
}
public String getValue() {
return value;
}
public static boolean contains(String test) {
for (SafeDBColumns c : SafeDBColumns.values()) {
if (c.name().equals(test)) {
return true;
}
}
return false;
}
public static boolean isEqualsIgnoreCase(SafeDBColumns column, String test) {
if (column == null || test == null) {
return false;
}
return column.getValue().equalsIgnoreCase(test);
}
public static SafeDBColumns fromString(String text) {
for (SafeDBColumns b : SafeDBColumns.values()) {
if (b.name().equalsIgnoreCase(text)) {
return b;
}
}
throw new IllegalArgumentException("No constant with text " + text + " found");
}
public boolean isEqualsIgnoreCase(String test) {
if (test == null) {
return false;
}
return this.value.equalsIgnoreCase(test);
}
}
@@ -1,46 +0,0 @@
package com.eactive.ext.kjb.safedb;
public class SafeDBWrapperException extends RuntimeException {
private Exception cause;
private int errcode;
public SafeDBWrapperException() {
}
public SafeDBWrapperException(String message) {
super(message);
}
public SafeDBWrapperException(String message, Throwable cause) {
super(message, cause);
}
public SafeDBWrapperException(String message, Exception cause) {
super(message);
this.cause = cause;
}
public SafeDBWrapperException(int errcode, String message) {
super(message);
this.errcode = errcode;
}
public SafeDBWrapperException(String errcode, String message) {
super(message);
this.errcode = new Integer(errcode);
}
public Throwable getCause() {
return this.cause;
}
public String getMessage() {
return this.cause != null ? super.getMessage() + "\n caused by [ " + this.cause.getMessage() + " ]" : super.getMessage();
}
public int getErrorCode() {
return this.errcode;
}
}
@@ -1,18 +0,0 @@
package com.eactive.ext.kjb.safedb;
public class SafeDBWrapperSdkException extends SafeDBWrapperException {
public SafeDBWrapperSdkException(Exception ex) {
super(ex.getMessage(), ex);
}
public SafeDBWrapperSdkException(String message) {
super(message);
}
public SafeDBWrapperSdkException(String message, Exception ex) {
super(message, ex);
}
public SafeDBWrapperSdkException() {
}
}
@@ -1,14 +1,19 @@
package com.eactive.ext.kjb.safedb;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
package kjb.safedb;
import javax.persistence.AttributeConverter;
import javax.persistence.Converter;
import org.apache.commons.lang3.StringUtils;
import com.eactive.ext.kjb.safedb.KjbSafedbWrapper;
import com.eactive.ext.kjb.safedb.SafeDBColumns;
import com.eactive.ext.kjb.safedb.Utils;
import lombok.extern.slf4j.Slf4j;
@Converter
@Slf4j
public class SafeDBMNotRnnoConverter implements AttributeConverter<String, String> {
public class KjbNotRnnoJpaAttributeConverter implements AttributeConverter<String, String> {
/**
* 암호화
* @param attribute the entity attribute value to be converted
@@ -20,8 +25,13 @@ public class SafeDBMNotRnnoConverter implements AttributeConverter<String, Strin
String originalAttribute = attribute;
if (StringUtils.isNotEmpty(attribute)) {
<<<<<<< HEAD:src/main/java/com/eactive/ext/kjb/safedb/SafeDBMNotRnnoConverter.java
SafeDBWrapper safeDBWrapper = SafeDBWrapper.getInstance();
attribute = safeDBWrapper.encryptNotRnnoString(attribute);
=======
KjbSafedbWrapper wrapper = KjbSafedbWrapper.getInstance();
attribute = wrapper.encryptNotRnnoString(attribute);
>>>>>>> 24cf3d16793cadad6d3810c0d0070a8d23834a0d:src/main/java/kjb/safedb/KjbNotRnnoJpaAttributeConverter.java
}
log.debug("DB 암호화 #2 : {} -> {}", originalAttribute, attribute);
@@ -42,7 +52,7 @@ public class SafeDBMNotRnnoConverter implements AttributeConverter<String, Strin
String dbDataOriginal = dbData;
if (StringUtils.isNotEmpty(dbData)) {
if (this.isEncrypted(dbData)) {
SafeDBWrapper safeDBWrapper = SafeDBWrapper.getInstance();
KjbSafedbWrapper safeDBWrapper = KjbSafedbWrapper.getInstance();
dbData = safeDBWrapper.decryptNotRnno(dbData);
} else {
log.debug("DB 복호화 경고: Base64 형식이 아님. 복호화하지 않고 원본 반환. dbData={}", dbData);
@@ -64,18 +74,18 @@ public class SafeDBMNotRnnoConverter implements AttributeConverter<String, Strin
return false;
}
data = data.trim();
// Base64 형식 체크
if (SafeDBWrapper.isBase64(data)) {
return true;
}
// 숫자, - 로만 구성된 경우 암호화 되지 않은 걸로 판단 (ex: 연락처)
if (data.matches("^[0-9-]+$")) {
return false;
}
data = data.trim();
// Base64 형식 체크
if (Utils.isBase64(data)) {
return true;
}
return false;
}
}