Skip to content

Commit bebdd93

Browse files
committed
feat: BCrypt 해시 유틸 추가
1 parent 6ecca44 commit bebdd93

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.somemore.global.encoder;
2+
3+
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
4+
import org.springframework.security.crypto.password.PasswordEncoder;
5+
6+
public class BCryptPasswordEncoderUtil {
7+
8+
private static final PasswordEncoder PASSWORD_ENCODER = new BCryptPasswordEncoder();
9+
10+
private BCryptPasswordEncoderUtil() {
11+
throw new UnsupportedOperationException("유틸리티 클래스는 인스턴스화할 수 없습니다.");
12+
}
13+
14+
public static String encode(String rawPassword) {
15+
return PASSWORD_ENCODER.encode(rawPassword);
16+
}
17+
18+
public static boolean matches(String rawPassword, String encodedPassword) {
19+
return PASSWORD_ENCODER.matches(rawPassword, encodedPassword);
20+
}
21+
}

0 commit comments

Comments
 (0)