当前位置:   article > 正文

Bad credentials问题解决_[auth] extension activation failed: "bad credentia

[auth] extension activation failed: "bad credentials

DEBUG mePasswordAuthenticationFilter - Authentication request failed: org.springframework.security.authentication.BadCredentialsException: Bad credentials

看到这个时最好检查一下依赖,配置文件,java中与加密的相关代码
检查后再看一下lo4j的日志
发现一个

 WARN  o.bcrypt.BCryptPasswordEncoder  - Encoded password does not look like BCrypt
2020-10-14 13:25:06,336 87043  [bio-1555-exec-3] DEBUG .dao.DaoAuthenticationProvider  - Authentication failed: password does not match stored value
2020-10-14 13:25:06,336 87043  [bio-1555-exec-3] DEBUG ort.DefaultListableBeanFactory  - Returning cached instance of singleton bean 'sqlSessionFactory'
2020-10-14 13:25:06,337 87044  [bio-1555-exec-3] DEBUG mePasswordAuthenticationFilter  - Authentication request failed: org.springframework.security.authentication.BadCredentialsException: Bad credentials

  • 1
  • 2
  • 3
  • 4
  • 5

Encoded password does not look like BCrypt
下午练习时爆出这个错误
当你采用安全框架设置加密后,如果要登录,由于之前是没有加密的密码所以会导致数据库里面的密码和现在的所输入的密码加密就会不一样,这时候的解决方式就是用java编程的方式来获取加密后的密码,然后将数据库里面对应的密码进行更换就可以
下面是获取加密的密码

public class BCryptPasswordEncoderUtils {

    private static BCryptPasswordEncoder bCryptPasswordEncoder=new BCryptPasswordEncoder();
    public static String encoderPassword(String password){
        return  bCryptPasswordEncoder.encode(password);
    }
     public  static  void  main(String[] args){
        String password="159753";
        String pwd=encoderPassword(password);
         System.out.println(pwd);
     }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/煮酒与君饮/article/detail/767153
推荐阅读
相关标签
  

闽ICP备14008679号