Spring源码分析【9】-SpringSecurity密码Remove原理
很明顯代碼已經說了認證完成移除credentials和其他某些安全數據
// Authentication is complete. Remove credentials and other secret data
// from authentication
org.springframework.security.authentication.ProviderManager.authenticate
package org.springframework.security.authentication.UsernamePasswordAuthenticationToken.eraseCredentials
org.springframework.security.authentication.AbstractAuthenticationToken.eraseCredentials
eraseSecret需要接口判斷
getCredentials()就是密碼
getPrincipal()得到的是userInfo
這個userinfo就是CustomUserDetailsService implements UserDetailsService中的函數
public UserDetails loadUserByUsername(String username)返回的UserDetails
UserInfo中的重寫的eraseCredentials
第三次eraseSecret是不行的,因為類型不對
回到上一步
這里定義的
回到主調用,這時候密碼相關的信息都null了
總結
以上是生活随笔為你收集整理的Spring源码分析【9】-SpringSecurity密码Remove原理的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: request.getSession(f
- 下一篇: 在jsp调试后端绑定对象