java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id “null“ at org.spr
2020-07-08 20:33
218 查看
Spring Security版本5使用了加密算法
和其他加密方式相比,BCryptPasswordEncoder有着它自己的优势所在,首先加密的hash值每次都不同,就像md5的盐值加密一样,只不过盐值加密用到了随机数,前者用到的是其内置的算法规则,毕竟随机数没有设合适的话还是有一定几率被攻破的。其次BCryptPasswordEncoder的生成加密存储串也有60位之多。最重要的一点是,md5的加密不是spring security所推崇的加密方式了,所以我们还是要多了解点新的加密方式。
通过传入的值进行BCryptPasswordEncoder加密,然后获取,再保存。
由于每次的hash值都不同,导致加密密文都不一样,其实这才是我们所希望看到的,而不是千篇一律。
通过加密密文后,密码可以加密了,但是我们会发现输入123456的密码进行登录时登录不了的,为什么?因为它识别不了我们加密密文和明文之间的转换,你需要告诉spring,我已经将明文进行转换,这里使用new BCryptPasswordEncoder().encode(“密码”)来解决。
auth.inMemoryAuthentication() .passwordEncoder(new BCryptPasswordEncoder()).withUser("nannan").password(new BCryptPasswordEncoder().encode("123")).roles("VIP1","VIP2");
相关文章推荐
- java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id "null"
- java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id "null"
- 解决记录之十一——Spring安全及java.lang.IllegalArgumentException:There is no PasswordEncoder mapped for the id错误
- IllegalArgumentException: There is no PasswordEncoder mapped for the id "null"
- Spring Security 无法登陆,报错:There is no PasswordEncoder mapped for the id “null”
- Spring Security 无法登陆,报错:There is no PasswordEncoder mapped for the id “null” 问题里的坑
- There is no PasswordEncoder mapped for the id "null"
- Spring Security 无法登陆,报错:There is no PasswordEncoder mapped for the id “null”
- Spring Security – There is no PasswordEncoder mapped for the id “null”解决方案
- SpringBoot整合Security登录报错 There is no PasswordEncoder mapped for the id "null"
- There is no PasswordEncoder mapped for the id “null”异常解决办法
- There is no PasswordEncoder mapped for the id “null”解决
- There is no PasswordEncoder mapped for the id "null"
- The given id must not be null!; nested exception is java.lang.IllegalArgumentException: The given id
- java.lang.IllegalArgumentException: The observer is null.终于解决方式
- java.lang.IllegalArgumentException: There is no shards to execute shard operation: 错误原因
- java.lang.IllegalArgumentException: No view found for id 0x7f090003 for fragment MainFg{40d57e28 #0
- java.lang.IllegalArgumentException: findUserById is ambiguous in Mapped Statements collection
- java.lang.IllegalArgumentException: id to load is required for loading
- java.lang.IllegalArgumentException:No view found for id for fragment 的解决