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?

Was it helpful?

Solution

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

new BCryptPasswordEncoder().encode(user.getPassword())
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top