我们需要在 spring OAuth2/token 端点上设置自定义 AuthenticationDetailsSource 以捕获我们的客户端必须提供的一些自定义 header 。
该端点的安全性似乎是在 org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerSecurityConfigurer 中配置的,我看不到覆盖它的方法。
有谁知道这是否可行以及如何实现?
最佳答案
没有“流畅”的 API 用于向客户端身份验证添加身份验证详细信息(假设这就是您的意思)。如果您放弃 @EnableAuthorizationServer
并直接扩展 AuthorizationServerEndpointsConfiguration
,您可以轻松控制 token 端点安全性。然后,您可以使用 WebSecurityConfigurerAdapter
以正常的 Spring Security 方式添加自己的安全配置。
关于java - 在 Spring Oauth2 token 端点上设置自定义 AuthenticationDetailsSource,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27002745/