我正在使用Spring Security OAuth2(http://projects.spring.io/spring-security-oauth/docs/oauth2.html)开发资源服务器,该服务器与Authorization Server交互以检索/验证Auth令牌 . 此处使用的OAuth流程是“客户端凭据” . 当资源服务器在授权服务器之后启动时,应用程序正常工作,但是在资源服务器在授权服务器之前启动的情况下,所有客户端请求都会收到状态代码为401的“无效令牌”错误 .
我可以想到使用拦截器来拦截使用ClientHttpRequestInterceptor的请求并具有重试逻辑 . 但 is there a correct approach to achieve proper resiliency or recovery mechanism for Resource Server 时,Auth Server在短时间内不可用 .
任何指针都会有所帮助 .
1 回答
有一个ResourceServerProperties issue,默认过滤顺序已更改 . 试试这个
security.oauth2.resource.filter-order = 3
Release note of oauth-2-resource-filter