Skip to content
This repository was archived by the owner on Aug 13, 2022. It is now read-only.

Commit f10506a

Browse files
committed
#18 패스워드 인코딩
시큐리티 필요한 라이브러만 사용하도록 수정 Account클래스가 비밀번호 암호화하는 책임을 갖지않고, 외부에서 암호화한 비밀번호만 내부 함수로 받도록 수정
1 parent 77b116d commit f10506a

File tree

3 files changed

+6
-17
lines changed

3 files changed

+6
-17
lines changed

pom.xml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -89,22 +89,10 @@
8989
<artifactId>spring-boot-starter-aop</artifactId>
9090
</dependency>
9191

92-
<!--스프링시큐리티 web 라이브러리-->
92+
<!--스프링시큐리티 crypto 라이브러리-->
9393
<dependency>
9494
<groupId>org.springframework.security</groupId>
95-
<artifactId>spring-security-web</artifactId>
96-
</dependency>
97-
98-
<!--스프링시큐리티 core 라이브러리-->
99-
<dependency>
100-
<groupId>org.springframework.security</groupId>
101-
<artifactId>spring-security-core</artifactId>
102-
</dependency>
103-
104-
<!--스프링시큐리티 config 라이브러리-->
105-
<dependency>
106-
<groupId>org.springframework.security</groupId>
107-
<artifactId>spring-security-config</artifactId>
95+
<artifactId>spring-security-crypto</artifactId>
10896
</dependency>
10997

11098
</dependencies>

src/main/java/com/younghun/hibusgo/domain/Account.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public enum Status {
4444
// 최종 수정일
4545
private LocalDateTime updatedAt;
4646

47-
public void encodePassword(PasswordEncoder passwordEncoder) {
48-
this.password = passwordEncoder.encode(this.password);
47+
public void setEncodePassword(String encodePassword) {
48+
this.password = encodePassword;
4949
}
5050
}

src/main/java/com/younghun/hibusgo/service/AccountService.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ public Account findById(String id) {
2424
}
2525

2626
public void addAccount(Account account) {
27-
account.encodePassword(passwordEncoder);
27+
String encodePassword = account.getPassword();
28+
account.setEncodePassword(encodePassword);
2829
accountMapper.addAccount(account);
2930
}
3031

0 commit comments

Comments
 (0)