My app uses preauthentication
I want to consume OAuth2 protected resources using ClientCredentialsResourceDetails
(signed fetch).
When using this in combination with an preauthenticated UserDetails
, spring does not store the 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 = ***
How can I make this work?
The token is stored in memory in the OAuth2RestTemplate
. That's good enough for most use cases because you can set it up as a singleton bean (one per client).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.