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調試,就能發現問題出在哪里了。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM