Skip to content

Commit

Permalink
feat : 암호화 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
sangminee committed Nov 1, 2023
1 parent 296a2f9 commit 80e93a9
Show file tree
Hide file tree
Showing 8 changed files with 181 additions and 10 deletions.
19 changes: 19 additions & 0 deletions .idea/dataSources.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/jpa-buddy.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified build/libs/UserService-0.0.1-SNAPSHOT.jar
Binary file not shown.
10 changes: 0 additions & 10 deletions build/tmp/bootJar/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -1,12 +1,2 @@
Manifest-Version: 1.0
Main-Class: org.springframework.boot.loader.JarLauncher
Start-Class: com.example.UserService.UserServiceApplication
Spring-Boot-Version: 3.1.3
Spring-Boot-Classes: BOOT-INF/classes/
Spring-Boot-Lib: BOOT-INF/lib/
Spring-Boot-Classpath-Index: BOOT-INF/classpath.idx
Spring-Boot-Layers-Index: BOOT-INF/layers.idx
Build-Jdk-Spec: 17
Implementation-Title: UserService
Implementation-Version: 0.0.1-SNAPSHOT

Binary file modified build/tmp/compileJava/previous-compilation-data.bin
Binary file not shown.
33 changes: 33 additions & 0 deletions src/main/java/com/example/UserService/config/JasyptConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.example.UserService.config;

import org.jasypt.encryption.StringEncryptor;
import org.jasypt.encryption.pbe.PooledPBEStringEncryptor;
import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class JasyptConfig {

@Value("${jasypt.encryptor.password}")
private String encryptKey;

@Bean("jasyptStringEncryptor")
public StringEncryptor stringEncryptor() {

PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();
SimpleStringPBEConfig config = new SimpleStringPBEConfig();

config.setPassword(encryptKey); // encrypt key
config.setAlgorithm("PBEWithMD5AndDES"); // 암호화 알고리즘
config.setKeyObtentionIterations("1000"); // 반복할 해싱 회수
config.setPoolSize("1"); // 인스턴스 pool
config.setProviderName("SunJCE");
config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator"); // salt 생성 클래스
config.setStringOutputType("base64"); //인코딩 방식
encryptor.setConfig(config);
return encryptor;
}

}
63 changes: 63 additions & 0 deletions src/main/resources/application-local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
server:
port: 8081

spring:
config:
activate:
on-profile: local

application:
name: User-Service

data:
redis:
host: localhost
port: 6379

jpa:
database: postgresql
hibernate:
dialect: org.hibernate.dialect.PostgresSQLDialect
hibernate.ddl-auto: create
show-sql: true
properties:
hibernate.format_sql: true

datasource:
hikari:
maximum-pool-size: 4
url: jdbc:postgresql://localhost:5432/ice_users
username: postgres
password: test12
driver-class-name: org.postgresql.Driver

mail:
host: smtp.gmail.com
port: 587
username: ENC(I+PDk31WFTOU39AypeTrZFVbb8MSpV9oL9q2C3HGQD8/1+Wj7fVmMw==)
password: ENC(TRk22TqlQbz1iTprwMnpiEMZLFAarFDjMf/iTDTnDCw=)
properties:
mail:
smtp:
auth: true
starttls:
enable: true
required: true
connection-timeout: 5000
timeout: 5000
write timeout: 5000
auth-code-expiration-millis: 1800000 # 30분

eureka:
instance:
instance-id: ${spring.application.name}:${spring.application.instance_id:${random.value}}
client:
register-with-eureka: true
fetch-registry: true
service-url:
defaultZone: http://localhost:8761/eureka

greeting:
message: Welcome to the Ice-Americano Page

secretKey: amazing
60 changes: 60 additions & 0 deletions src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
server:
port: 8081

spring:
config:
activate:
on-profile: prod

data:
redis:
host: localhost
port: 6379

application:
name: User-Service

datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: ENC(IiuEBphb1S9PmnqVHOLwRbRwEo1POJmm42W7J/XS3s7Eeh02Kt7VVi62X8v2+JZYYSNNuy2n8B+UYKLkxMBeDzQ/4t4PuorJtR2W8EKHWXdkUgZc+ppIztrCLhxqQ0ohm/oNkMlNiBy+ZC6bsQe3UE/g1SVsKHFvh+ndsQoD/+PlyljVCs6eog==)
username: ENC(R9ELUhikhPOj9EworsW/Nw==)
password: ENC(JPbOCKIfxPLVNTSoWB7TYrmLrB0Pup/c)

jpa:
show-sql: true
hibernate:
ddl-auto: update
properties:
hibernate:
format_sql: true

mail:
host: smtp.gmail.com
port: 587
username: ENC(I+PDk31WFTOU39AypeTrZFVbb8MSpV9oL9q2C3HGQD8/1+Wj7fVmMw==)
password: ENC(TRk22TqlQbz1iTprwMnpiEMZLFAarFDjMf/iTDTnDCw=)
properties:
mail:
smtp:
auth: true
starttls:
enable: true
required: true
connection-timeout: 5000
timeout: 5000
write timeout: 5000
auth-code-expiration-millis: 1800000 # 30분

eureka:
instance:
instance-id: ${spring.application.name}:${spring.application.instance_id:${random.value}}
client:
register-with-eureka: true
fetch-registry: true
service-url:
defaultZone: http://52.78.155.253:8761/eureka

greeting:
message: Welcome to the Ice-Americano Page

secretKey: amazing

0 comments on commit 80e93a9

Please sign in to comment.