forked from wine-area/DMS-Backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
90 additions
and
47 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
dms-core/src/main/kotlin/team/aliens/dms/domain/room/service/RoomService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
dms-persistence/src/main/kotlin/team/aliens/dms/common/annotation/EncryptAnnotations.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package team.aliens.dms.common.annotation | ||
|
||
import java.lang.annotation.Inherited | ||
|
||
/** | ||
* 저장시 암호화되는 컬럼을 명시해주기 위한 어노테이션 | ||
*/ | ||
@Retention(AnnotationRetention.RUNTIME) | ||
@Target(AnnotationTarget.FIELD) | ||
annotation class EncryptedColumn( | ||
val type: EncryptType | ||
) | ||
|
||
enum class EncryptType { | ||
SYMMETRIC, | ||
ASYMMETRIC | ||
} | ||
|
||
/** | ||
* 메서드의 반환값에서 EncryptedColmn이 붙은 필드을 암호화하는 어노테이션 | ||
* @see EncryptedColumn | ||
* @see team.aliens.dms.persistence.EncryptableGenericMapper | ||
*/ | ||
@Inherited | ||
@Retention(AnnotationRetention.RUNTIME) | ||
@Target(AnnotationTarget.FUNCTION) | ||
annotation class Encrypt | ||
|
||
/** | ||
* 메서드의 반환값에서 EncryptedColmn이 붙은 필드을 복호화하는 어노테이션 | ||
* @see EncryptedColumn | ||
*/ | ||
@Inherited | ||
@Retention(AnnotationRetention.RUNTIME) | ||
@Target(AnnotationTarget.FUNCTION) | ||
annotation class Decrypt | ||
|
||
/** | ||
* 파라미터 전달시에 암호화된 엔티티를 복호화하는 어노테이션 | ||
* @see team.aliens.dms.persistence.EncryptableGenericMapper | ||
*/ | ||
@Inherited | ||
@Retention(AnnotationRetention.RUNTIME) | ||
@Target(AnnotationTarget.VALUE_PARAMETER) | ||
annotation class Decrypted( | ||
val value: String = "" | ||
) |
12 changes: 12 additions & 0 deletions
12
dms-persistence/src/main/kotlin/team/aliens/dms/persistence/EncryptableGenericMapper.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package team.aliens.dms.persistence | ||
|
||
import team.aliens.dms.common.annotation.Decrypted | ||
import team.aliens.dms.common.annotation.Encrypt | ||
|
||
interface EncryptableGenericMapper<D, E> : GenericMapper<D, E> { | ||
|
||
override fun toDomain(@Decrypted entity: E?): D? | ||
|
||
@Encrypt | ||
override fun toEntity(domain: D): E | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters