Spring Security 请求流程
token 过期请求流程
- EnableConfigurationProperties 开启 security
- ResourceServerSecurityConfigurer 资源安全服务配置
- OAuth2AuthenticationManager oauthAuthenticationManager = new OAuth2AuthenticationManager(); 鉴权认证
- OAuth2Authentication auth = tokenServices.loadAuthentication(token); token 认证
- DefaultTokenServices.loadAuthentication(String accessTokenValue) throws AuthenticationException, InvalidTokenException 获取认证信息
- OAuth2AccessToken accessToken = tokenStore.readAccessToken(accessTokenValue); 读取认证信息
- CustomRedisTokenStore.readAccessToken(String tokenValue)
1 | public OAuth2AccessToken readAccessToken(String tokenValue) { |
- OAuth2AuthenticationProcessingFilter.doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException filter 过滤
token 正常请求流程
- ResourceServerConfiguration.setAuthenticate(ExpressionUrlAuthorizationConfigurer
.AuthorizedUrl authorizedUrl) - permissionService.hasPermission(request, authentication)
- DefaultPermissionServiceImpl.hasPermission(Authentication authentication, String requestMethod, String requestURI)
- TokenEndpoint.postAccessToken /oauth/token
- …