<authentication-manager erase-credentials="false">

...

</authentication-manager>

erase-credentials默认为true,会在

public Authentication authenticate(Authentication authentication) throws AuthenticationException

返回前调用 ((CredentialsContainer)result).eraseCredentials(); 清除credentials等信息,所以我们使用

SecurityContextImpl securityContextImpl = (SecurityContextImpl) request
.getSession().getAttribute("SPRING_SECURITY_CONTEXT");
Authentication authentication = securityContextImpl.getAuthentication();
// 登录密码,未加密的
String password = (String)(authentication.getCredentials());

password总是为null。

将erase-credentials设置为false后,不会清除这些保密信息,但是建议在使用完之后自己调用eraseCredentials()清楚这些信息。

最新文章

  1. Linux sort 命令
  2. Ubuntu菜鸟入门(四)—— 搜狗输入法
  3. 学习Maven之Properties Maven Plugin
  4. git恢复误删文件及省去密码提交
  5. hiho_1041 国庆出游
  6. saiku-添加数据源以及保证数据源的一致性
  7. chattr实现文件不可删除
  8. 一个实例明白AutoResetEvent和 ManulResetEvent的用法
  9. HTML5 &lt;Audio/&gt;标签Api整理(二)
  10. SIM卡尺寸及剪卡教程
  11. TreeSet()详解
  12. CSS概要
  13. 兼容低版本JS的Array.map方法
  14. GridView 多余字符显示省略号,并在Tooltip中显示完整信息
  15. 终止Docker容器
  16. Qt for Android开发总结
  17. fork()相关的源码解析
  18. Java 发送SOAP请求调用WebService,解析SOAP报文
  19. netty源码理解(三) 从channel读取数据
  20. mui 百度语音识别转换文字

热门文章

  1. Listview 利用Datapager进行分页
  2. CString::MakeLower Crash
  3. 如何从Spring官网下载Spring的jar包
  4. spring boot日志及Log4j日志配置
  5. 数据结构之BF算法,kmp算法,三元组,十字链表总结
  6. 使用IIS服务器部署网页,需要开启服务里的“ASP.NET 状态服务”
  7. 洛谷P4207 [NOI2005]月下柠檬树(计算几何+自适应Simpson法)
  8. 【Thread】线程工厂-ThreadFactory
  9. 2008R2 无法安装 HDP Apache 系列服务解决方案
  10. BDD 相关整理---介绍