繁体   English   中英

Spring OAuth2 client_credentials与预先认证的用户结合使用

[英]Spring OAuth2 client_credentials in combination with preauthenticated user

我的应用使用了预身份验证

我想使用ClientCredentialsResourceDetails (签名访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(每个客户端一个)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM