Closed bgard68 closed 1 year ago
I added this code and then it works for me. Otherwise, I did not find anywhere what the password is for the defined user and admin.
@Bean
public UserDetailsService users() {
String pass = encoder().encode("ja");
UserDetails user = User.builder()
.username("user")
// password = password with this hash, don't tell anybody :-)
//.password("{bcrypt}$2a$10$GRLdNijSQMUvl/au9ofL.eDwmoohzzS7.rmNSJZ.0FxO/BTk76klW")
.password(pass)
.roles("USER")
.build();
UserDetails admin = User.builder()
.username("admin")
//.password("{bcrypt}$2a$10$GRLdNijSQMUvl/au9ofL.eDwmoohzzS7.rmNSJZ.0FxO/BTk76klW")
.password(pass)
.roles("USER", "ADMIN")
.build();
return new InMemoryUserDetailsManager(user, admin); // <5>
}
@Bean
public PasswordEncoder encoder() {
return new BCryptPasswordEncoder();
}
Thank you for responding so quickly, @jankod . I've added the above code and tried logging in as admin, ja and still login error, as if, the SecurityConfig isn't recognized.
I just cloned the repo, started the application and was able to login without any change
idk what im doing wrong but not able to login as is. moving on. Thanks again for the quick responses.
This is the code in the github repository v24 branch and I have tried many combos and nothing seems to work. What am I missing to be able to login locally ?
@Bean public UserDetailsService users() { UserDetails user = User.builder() .username("user") // password = password with this hash, don't tell anybody :-) .password("{bcrypt}$2a$10$GRLdNijSQMUvl/au9ofL.eDwmoohzzS7.rmNSJZ.0FxO/BTk76klW") .roles("USER") .build(); UserDetails admin = User.builder() .username("admin") .password("{bcrypt}$2a$10$GRLdNijSQMUvl/au9ofL.eDwmoohzzS7.rmNSJZ.0FxO/BTk76klW") .roles("USER", "ADMIN") .build(); return new InMemoryUserDetailsManager(user, admin); // <5>