diff --git a/example_29/src/main/java/com/eazybytes/eazyschool/config/ProjectSecurityConfig.java b/example_29/src/main/java/com/eazybytes/eazyschool/config/ProjectSecurityConfig.java index 6e82bdbb..d7b8442b 100644 --- a/example_29/src/main/java/com/eazybytes/eazyschool/config/ProjectSecurityConfig.java +++ b/example_29/src/main/java/com/eazybytes/eazyschool/config/ProjectSecurityConfig.java @@ -35,19 +35,27 @@ SecurityFilterChain defaultSecurityFilterChain(HttpSecurity http) throws Excepti } @Bean - public InMemoryUserDetailsManager userDetailsService() { - - UserDetails user = User.withDefaultPasswordEncoder() + public InMemoryUserDetailsManager userDetailsManagerService() { + + UserDetails user = User.builder() .username("user") - .password("12345") + .password(passwordEncoder().encode("123456")) .roles("USER") .build(); - UserDetails admin = User.withDefaultPasswordEncoder() + + UserDetails admin = User.builder() .username("admin") - .password("54321") + .password(passwordEncoder().encode("123456")) .roles("USER", "ADMIN") .build(); + return new InMemoryUserDetailsManager(user, admin); } + @Bean + protected PasswordEncoder passwordEncoder() { + + return new BCryptPasswordEncoder(); + } + }