I'm trying to learn Spring boot security currently. I want to authorize with database without password encoding. What Configuration is need for this?
1 Answer
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
// configure AuthenticationManager so that it knows from where to load
// user for matching credentials
// Use BCryptPasswordEncoder
auth.userDetailsService(jwtUserDetailsService).passwordEncoder(passwordEncoder());
}
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
if u need to use password Encoder u just need t add this Bean
2 Comments
გენო მუმლაძე
nooooo! i want to log in without any encoding password, if in db password is "root" when my password is "root".
medidriss
see this link stackoverflow.com/questions/51208425/…