簡體   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