Question

I have the following:

   @Override
protected void registerAuthentication(AuthenticationManagerBuilder auth) throws Exception {
    auth.userDetailsService(userDetailsManager()).passwordEncoder(passwordEncoder());
}

@Bean
public MongoUserDetailsService userDetailsManager() {
    return new MongoUserDetailsService();
}

@Bean
public BCryptPasswordEncoder passwordEncoder() {
    return new BCryptPasswordEncoder();
}

in my WebSecurityConfigurerAdapter and it seems to be working OK for checking the password on login.

Am I missing anything else to be able to store the password encrypted as well?

Était-ce utile?

La solution

I just needed to encrypt the password programatically when I was storing it. Essentially:

new BCryptPasswordEncoder().encode(user.getPassword())
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top