SpringBoot 集成 Security 時(shí),報(bào) Encoded password does not look like BCrypt
原因:SecurityConfig 必須 Bean 的形式實(shí)例化文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-432701.html
/**
* 配置用戶身份的configure()方法
*
* @param auth
* @throws Exception
*/
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailsService).passwordEncoder(new BCryptPasswordEncoder());
}
解決方案文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-432701.html
/**
* 強(qiáng)散列哈希加密實(shí)現(xiàn)
* 必須 Bean 的形式實(shí)例化,否則會(huì)報(bào) :Encoded password does not look like BCrypt
*/
@Bean
public BCryptPasswordEncoder bCryptPasswordEncoder()
{
return new BCryptPasswordEncoder();
}
/**
* 配置用戶身份的configure()方法
*
* @param auth
* @throws Exception
*/
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder());
}
到了這里,關(guān)于Spring Security 報(bào):Encoded password does not look like BCrypt的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!