Consider defining a bean of type ‘org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder’ in your configuration.

When you get this error : Consider defining a bean of type ‘org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder’ in your configuration.

The solution is to add the BCrypt Encoder as a bean in the class main of your spring boot project :

        @Bean
	@Primary
	public BCryptPasswordEncoder getpce()
	{
		return new BCryptPasswordEncoder();
	}

And add the methode to decrypt the passwords from DataBase

public static String hash(String password,int row) {
        return BCrypt.hashpw(password, BCrypt.gensalt(row));
    }

Lire aussi : Spring Security Error : AuthenticationManager

Laisser un commentaire