Skip to content

Commit ff38ebf

Browse files
author
eugenp
committed
cleanup in the registration process
1 parent 4179c84 commit ff38ebf

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

spring-security-login-and-registration/src/main/java/org/baeldung/persistence/service/UserService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ public class UserService implements IUserService {
2424
@Autowired
2525
private PasswordEncoder passwordEncoder;
2626

27+
// API
28+
2729
@Override
2830
public User registerNewUserAccount(UserDto accountDto) throws EmailExistsException {
2931
if (emailExist(accountDto.getEmail())) {

spring-security-login-and-registration/src/main/java/org/baeldung/spring/SecSecurityConfig.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,13 @@
1616
public class SecSecurityConfig {
1717

1818
@Autowired
19-
UserDetailsService userDetailsService;
19+
private UserDetailsService userDetailsService;
2020

2121
public SecSecurityConfig() {
2222
super();
2323
}
2424

25-
@Bean
26-
public BCryptPasswordEncoder encoder() {
27-
BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(11);
28-
return encoder;
29-
}
25+
// beans
3026

3127
@Bean
3228
public DaoAuthenticationProvider authProvider() {
@@ -37,8 +33,8 @@ public DaoAuthenticationProvider authProvider() {
3733
}
3834

3935
@Bean
40-
public PasswordEncoder passwordEncoder() {
41-
return new BCryptPasswordEncoder();
36+
public PasswordEncoder encoder() {
37+
return new BCryptPasswordEncoder(11);
4238
}
4339

4440
}

0 commit comments

Comments
 (0)