diff --git a/.gitignore b/.gitignore index 2f40306..3ad450b 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/build.gradle b/build.gradle index 025edc5..724bf1f 100644 --- a/build.gradle +++ b/build.gradle @@ -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 { diff --git a/src/main/java/com/eactive/apim/portal/portaluser/entity/PortalUser.java b/src/main/java/com/eactive/apim/portal/portaluser/entity/PortalUser.java index 6253802..74b8715 100644 --- a/src/main/java/com/eactive/apim/portal/portaluser/entity/PortalUser.java +++ b/src/main/java/com/eactive/apim/portal/portaluser/entity/PortalUser.java @@ -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) diff --git a/src/main/java/com/eactive/ext/kjb/safedb/SafeDBBroker.java b/src/main/java/com/eactive/ext/kjb/safedb/SafeDBBroker.java deleted file mode 100644 index 187d450..0000000 --- a/src/main/java/com/eactive/ext/kjb/safedb/SafeDBBroker.java +++ /dev/null @@ -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); - } -} diff --git a/src/main/java/com/eactive/ext/kjb/safedb/SafeDBColumns.java b/src/main/java/com/eactive/ext/kjb/safedb/SafeDBColumns.java deleted file mode 100644 index a4d6b73..0000000 --- a/src/main/java/com/eactive/ext/kjb/safedb/SafeDBColumns.java +++ /dev/null @@ -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); - } -} diff --git a/src/main/java/com/eactive/ext/kjb/safedb/SafeDBWrapperException.java b/src/main/java/com/eactive/ext/kjb/safedb/SafeDBWrapperException.java deleted file mode 100644 index e28c846..0000000 --- a/src/main/java/com/eactive/ext/kjb/safedb/SafeDBWrapperException.java +++ /dev/null @@ -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; - } -} diff --git a/src/main/java/com/eactive/ext/kjb/safedb/SafeDBWrapperSdkException.java b/src/main/java/com/eactive/ext/kjb/safedb/SafeDBWrapperSdkException.java deleted file mode 100644 index 750da82..0000000 --- a/src/main/java/com/eactive/ext/kjb/safedb/SafeDBWrapperSdkException.java +++ /dev/null @@ -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() { - } -} diff --git a/src/main/java/com/eactive/ext/kjb/safedb/SafeDBMNotRnnoConverter.java b/src/main/java/kjb/safedb/KjbNotRnnoJpaAttributeConverter.java similarity index 75% rename from src/main/java/com/eactive/ext/kjb/safedb/SafeDBMNotRnnoConverter.java rename to src/main/java/kjb/safedb/KjbNotRnnoJpaAttributeConverter.java index 060a9af..f35e319 100644 --- a/src/main/java/com/eactive/ext/kjb/safedb/SafeDBMNotRnnoConverter.java +++ b/src/main/java/kjb/safedb/KjbNotRnnoJpaAttributeConverter.java @@ -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 { +public class KjbNotRnnoJpaAttributeConverter implements AttributeConverter { /** * 암호화 * @param attribute the entity attribute value to be converted @@ -20,8 +25,13 @@ public class SafeDBMNotRnnoConverter implements AttributeConverter>>>>>> 24cf3d16793cadad6d3810c0d0070a8d23834a0d:src/main/java/kjb/safedb/KjbNotRnnoJpaAttributeConverter.java } log.debug("DB 암호화 #2 : {} -> {}", originalAttribute, attribute); @@ -42,7 +52,7 @@ public class SafeDBMNotRnnoConverter implements AttributeConverter