原文:https://blog.csdn.net/bluuusea/article/details/80284458
1.一個比較重要的過濾器
2.此處是①中的attemptAuthentication方法
3.此處是②中調用的authenticate方法
4.此處是③中調用的AbstractUserDetailsAuthenticationProvider類的authenticate方法
5.此處是④中調用的DaoAuthenticationProvider類的retrieveUser方法
6.此處為⑤中調用的ClientDetailsUserDetailsService類的loadUserByUsername方法,執行完后接着返回執行④之后的方法
7.此處為④中調用的DaoAuthenticationProvider類的additionalAuthenticationChecks方法,此處執行完則主要過濾器執行完畢,后續會進入/oauth/token映射的方法
8.此處進入/oauth/token映射的TokenEndpoint類的postAccessToken方法
9.此處為⑧中調用的AbstractTokenGranter類的grant方法
10.此處為⑨中調用的ResourceOwnerPasswordTokenGranter類中的getOAuth2Authentication方法
11.此處為⑩中調用的自定義的CustomUserAuthenticationProvider類中的authenticate方法,此處校驗用戶密碼是否正確,此處執行完則返回⑨執行后續方法。
12.此處為⑨中調用的DefaultTokenServices中的createAccessToken方法
13.此處為12中調用的RedisTokenStore中的getAccessToken方法等,此處執行完,則一直向上返回到⑧中執行后續方法。
14.此處為⑧中獲取到token后需要包裝返回流操作