Spring Security 报:Encoded password does not look like BCrypt

Posted VipSoft

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Spring Security 报:Encoded password does not look like BCrypt相关的知识,希望对你有一定的参考价值。

SpringBoot 集成 Security 时,报 Encoded password does not look like BCrypt
原因:SecurityConfig 必须 Bean 的形式实例化

/**
 * 配置用户身份的configure()方法
 *
 * @param auth
 * @throws Exception
 */
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception 
    auth.userDetailsService(userDetailsService).passwordEncoder(new BCryptPasswordEncoder());


解决方案

/**
 * 强散列哈希加密实现 
 * 必须 Bean 的形式实例化,否则会报 :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());

spring security 登陆报错java.lang.StackOverflowError: null?

@Bean
public AuthenticationManager authenticationManager() throws Exception
return super.authenticationManagerBean();

加上这个叫报登陆时就报异常
java.lang.StackOverflowError: null
at ch.qos.logback.classic.LoggerContext.getTurboFilterChainDecision_0_3OrMore(LoggerContext.java:269) ~[logback-classic-1.2.3.jar:na]
at ch.qos.logback.classic.Logger.callTurboFilters(Logger.java:751) ~[logback-classic-1.2.3.jar:na]
at ch.qos.logback.classic.Logger.isDebugEnabled(Logger.java:469) ~[logback-classic-1.2.3.jar:na]
at ch.qos.logback.classic.Logger.isDebugEnabled(Logger.java:465) ~[logback-classic-1.2.3.jar:na]
这是一部分

参考技术A 有变量未初始化,就使用

~~~~~~~~~~

以上是关于Spring Security 报:Encoded password does not look like BCrypt的主要内容,如果未能解决你的问题,请参考以下文章

添加“spring-security-taglibs”后jsp中仍然报错:找不到spring security标签的标签库描述符

Spring Security和Swagger2集成报错

spring security 5.0 密码未加密报错

学习Spring Cloud中eureka注册中心添加security认证,eureka client注册启动报错

BASE64Encoded() 方法报错说方法未定义

laravle框架报错Malformed UTF-8 characters, possibly incorrectly encoded