Reputation: 2148
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?
Upvotes: 1
Views: 821
Reputation: 58094
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).
Upvotes: 1