Java Spring OAuth2客户端_凭据与预验证的用户
我的应用程序使用 我想使用Java Spring OAuth2客户端_凭据与预验证的用户,java,spring-mvc,spring-security,spring-boot,spring-security-oauth2,Java,Spring Mvc,Spring Security,Spring Boot,Spring Security Oauth2,我的应用程序使用 我想使用ClientCredentialsResourceDetails(签名获取)使用OAuth2保护的资源 当将其与预验证的UserDetails结合使用时,spring不会存储OAuth令牌: DEBUG o.s.s.w.a.AnonymousAuthenticationFilter - SecurityContextHolder not populated with anonymous token, as it already contained: 'org.sprin
ClientCredentialsResourceDetails
(签名获取)使用OAuth2保护的资源
当将其与预验证的UserDetails
结合使用时,spring不会存储OAuth令牌:
DEBUG o.s.s.w.a.AnonymousAuthenticationFilter - SecurityContextHolder not populated with anonymous token, as it already contained: 'org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken@4662f11e: Principal: User = ***
如何使其工作?令牌存储在
OAuth2RestTemplate
中的内存中。这对于大多数用例来说已经足够好了,因为您可以将它设置为一个单例bean(每个客户端一个)。对不起,我还不明白这个问题。如果您已通过容器预验证,那么为什么需要OAuth2,以及您希望令牌存储在何处?我想使用一个使用OAuth2和客户端凭据的api。为了节省时间,最好存储下一个请求的令牌?