查了下发现是spring security 版本在5.0后就要加个PasswordEncoder了

解决办法
  1. 在securityConfig类下加入NoOpPasswordEncoder,不过官方已经不推荐了
    @Bean
public static NoOpPasswordEncoder passwordEncoder() {
return (NoOpPasswordEncoder) NoOpPasswordEncoder.getInstance();
}
  1. 在securityConfig类下加入密码加密,在数据库中存的密码也是要经过这个加密的才能匹配上
    @Autowired
private UserDetailsService customUserService; @Override
public void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(customUserService).passwordEncoder(new BCryptPasswordEncoder());
}

补充:加密操作

    public static void main(String[] args) {
BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
//加密"0"
String encode = bCryptPasswordEncoder.encode("0");
System.out.println(encode);
//结果:$2a$10$/eEV4X7hXPzYGzOLXfCizu6h7iRisp7I116wPA3P9uRcHAKJyY4TK
}

作者:yyq唯心不易
链接:https://www.jianshu.com/p/9e7792d767b2
来源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

最新文章

  1. nw.js桌面软件开发系列 第0.1节 HTML5和桌面软件开发的碰撞
  2. HTML5初学总结
  3. JIRA 6.3.6版本部署
  4. ionic添加admob广告教程
  5. LTMP手动编译安装以及全自动化部署实践(附详细代码)
  6. Java WEB —— Java提升
  7. 如何在 Windows Azure 的虚拟机 ubuntu 上面安装和配置 openVPN(二)
  8. C#解leetcode 106. Construct Binary Tree from Inorder and Postorder Traversal
  9. 逆向并查集 hrbust 1913
  10. Operation System - Peterson's Solution算法 解决多线程冲突
  11. Ubuntu 12.04 下安装git
  12. Phaser小游戏
  13. Itunes制作手机铃声,图文版
  14. 常用Oracle进程资源查询语句(运维必看)
  15. GCD API记录(二)
  16. Linux中shell和子shell一点点理解
  17. hadoop fsck详解
  18. MetaMask/sw-controller
  19. A pointer is a variable whose value is the address of another variable 指针 null pointer 空指针 内存地址0 空指针检验
  20. CentOS7安装部署zabbix3.4操作记录

热门文章

  1. centos7配置mysql8.0主从复制
  2. vue.js 分页加载,向上滑动,依次加载数据。
  3. Shiro多Realm验证
  4. pycharm 激激活码
  5. aria2的安装与配置
  6. Kubernetes集群详细介绍及部署
  7. [BZOJ1299]巧克力棒(博弈论,线性基)
  8. Codeforces 919 行+列前缀和 树上记忆化搜索(树形DP)
  9. 如果该虚拟机未在使用,请按“获取所有权(T)”按钮获取它的所有权。否则,请按“取消(C)”按钮以防损坏
  10. C++打开属性对话框并保持其处于打开状态