File tree Expand file tree Collapse file tree 3 files changed +7
-0
lines changed
src/main/java/link/hiroshisprojects/kaput/user Expand file tree Collapse file tree 3 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,9 @@ dependencies {
27
27
28
28
runtimeOnly ' org.postgresql:postgresql'
29
29
30
+ // pw encrypt/decrypt
31
+ implementation ' org.mindrot:jbcrypt:0.4'
32
+
30
33
// hateoas
31
34
implementation ' org.springframework.hateoas:spring-hateoas:1.5.2'
32
35
Original file line number Diff line number Diff line change 4
4
5
5
import javax .validation .ConstraintViolationException ;
6
6
7
+ import org .mindrot .jbcrypt .BCrypt ;
7
8
import org .springframework .stereotype .Service ;
8
9
9
10
@ Service
@@ -17,6 +18,9 @@ public UserServiceImpl(UserDao userDao) {
17
18
18
19
@ Override
19
20
public User save (User user ) throws ConstraintViolationException {
21
+ String encrypted = BCrypt .hashpw (user .getPassword (), BCrypt .gensalt (10 ));
22
+ user .setPassword (encrypted );
23
+
20
24
return userDao .save (user );
21
25
}
22
26
You can’t perform that action at this time.
0 commit comments