spring-security - Spring Security OAuth2 资源服务器重试/弹

我正在使用 Spring Security OAuth2(http://projects.spring.io/spring-security-oauth/docs/oauth2.html)开发资源服务器,它与授权服务器交互以检索/验证授权 token 。此处使用的 OAuth Flow 是“客户端凭据”。当资源服务器在授权服务器之后启动时,应用程序工作正常,但在资源服务器在授权服务器之前启动的情况下,所有客户端请求都会收到状态代码为 401 的“无效 token ”错误。

我可以考虑使用拦截器拦截使用 ClientHttpRequestInterceptor 的请求并具有重试逻辑。但是,当 Auth Server 短时间不可用时,是否有正确的方法来为 Resource Server 实现适当的弹性或恢复机制

任何指示都会有所帮助。

最佳答案

有一个ResourceServerProperties issue默认过滤顺序已更改。试试这个 security.oauth2.resource.filter-order = 3

OAuth 2 Resource Filter The default order of the OAuth2 resource filter has changed from 3 to SecurityProperties.ACCESS_OVERRIDE_ORDER - 1. This places it after the actuator endpoints but before the basic authentication filter chain. The default can be restored by setting security.oauth2.resource.filter-order = 3

Release note of oauth-2-resource-filter

关于spring-security - Spring Security OAuth2 资源服务器重试/弹性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49186584/

相关文章:

git - 致命的 : protocol error: bad line length charac

asp.net-core - ASP.NET 核心 : Initiating a request t

r - tcltk 对话框出现在 RStudio/Shiny Windows 下

azure-ad-b2c - 休息 API 超时

hibernate - QueryDSL - 仅比较 dateTime 中的日期

amazon-web-services - AWS Batch 可以运行 Windows Docke

css - 如何将样式导出到样式组件中的外部样式表?

php - 如何使用 discord API 从用户名获取 discord 用户 ID

ios - UITextContentType* 不工作

php - 在 PHP 中从文件流创建 Zip