shiro 权限框架,登陆报以下错误Authentication failed for token submission

Authentication failed for token submission [org.apache.shiro.authc.UsernamePasswordToken - admin, rememberMe=false].  
Possible unexpected error? (Typical or expected login exceptions should extend from AuthenticationException).
原因:
我今天也遇到了这个错误,并不是密码验证错误, 我用的mabatis 有个mapperxml配置文件写错(并非登录相关的mapper),
参数类型是parametertype 我搞成了parametermap 报错就是这个错误。分析下在登录时login方法会调用我们重写的doGetAuthenticationInfo方法,
这个方法我们会通过dao实现层写的登录验证相关方法(我的是Admin admin = this.accountService.findAdmin(username))来将登录信息存入
SimpleAuthenticationInfo,就是在这个地方,项目会加载我们所配置的相关信息,对我而言就是mabatis里的xml 因为xml里的配置有错,
所以Admin admin = this.accountService.findAdmin(username)这个方法尽管与出错的xml无关也会报错。
所以说应该检查下自己与doGetAuthenticationInfo相关的配置文件是否有从,可以try{currentUser.login(token)}
catch(AuthenticationException a){}异常捕获后再次debug调试,就能发现问题出在哪里了。
posted @ 2015-12-31 14:30  回看欧洲  阅读(9912)  评论(0编辑  收藏  举报