首页 > 编程语言 > 详细

S - Spring Security Bad Principal Exception

时间:2014-10-10 13:18:35      阅读:316      评论:0      收藏:0      [点我收藏+]

项目中配置了Spring Security,通过自定义的UserDetailsService实现loadUserByName方法能够查出用户的信息,在继续运行至DaoAuthorityXXX时,在UsernamePasswordToken时,报出Bad Principal异常,检查之后是因为 在security 配置中

配置了

<s:authentication-manager alias="authenticationManager">

<s:authentication-provider user-service-ref="userDetailsService">

<s:password-encoder hash="md5" />

</s:authentication-provider>

</s:authentication-manager>

数据库中的密码没有加密,所以springsecurity在比较用户输入的用户名,密码时,密码不一致抛出 Bad Principal Exception

解决方法:

更改:<s:password-encoder hash="md5" /> 为 <s:password-encoder hash="plaintext" />,即没有加密处理。


S - Spring Security Bad Principal Exception

原文:http://my.oschina.net/fuckboogie/blog/325633

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!