我的应用程序使用 preauthentication
我想使用 ClientCredentialsResourceDetails
(签名提取)使用 OAuth2 protected 资源。
当将此与预身份验证的UserDetails
结合使用时,spring不会存储OAuth token :
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 = ***
我怎样才能做到这一点?
最佳答案
token 存储在 OAuth2RestTemplate
的内存中。这对于大多数用例来说已经足够了,因为您可以将其设置为单例 bean(每个客户端一个)。
关于java - Spring OAuth2 client_credentials 与预身份验证用户相结合,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28941692/