org.apache.shiro.authc.IncorrectCredentialsException: Submitted credentials for token [org.apache.sh
java shiro    2017-07-19 23:45:15    1099   
lightingfire   java shiro

org.apache.shiro.authc.IncorrectCredentialsException: Submitted credentials for token [org.apache.shiro.authc.UsernamePasswordToken - **, rememberMe=false] did not match the expected credentials.

shiro在实现登陆认证的时候,一般从前端传来的是明文密码,而我们库中存放的是hash值,于是我们就需要转换下user的密码,

当然,我们有可能会在使用验证查询的时候,将user的密码转换成hash,然而在loginAction中,存放的user中的密码仍为明文,此时会出现错误

解决办法,在loginAction获取到pwd后,将其替换为hash,然后认证成功后存放到session中就ok了

 

user.setPwd(MD5Util.md5(user.getPwd())); 

 

by 刘迎光@萤火虫工作室
OpenBI交流群:495266201
MicroService 微服务交流群:217722918
mail: liuyg#liuyingguang.cn
博主首页(防止爬虫):http://blog.liuyingguang.cn
OpenBI问答社区:http://openbi.liuyingguang.cn/

Pre: Extjs根据条件设置表格某行背景色

Next: SqlServer修改数据库文件存放位置


Table of content