I have a resource server application for which I want to define a controller that needs to get hold of additional information from OAuth2AccessToken
. The additional information in the token are added using the authorization server's TokenEnhancer
. However, I'm not really sure which part of the whole Spring OAuth 2 configuration I can use for this. I'm using a RemoteTokenServices
in my application, which provides a readAccessToken
method. However, when I try to use it, I get UnsupportedOperationException
.
Asked
Active
Viewed 823 times
4

Psycho Punch
- 6,418
- 9
- 53
- 86
-
What information specifically are you needing? What does the enhancement look like? – chrylis -cautiouslyoptimistic- Dec 12 '16 at 08:13
-
I've added a few user-related details in the token, like UUID, etc. – Psycho Punch Dec 12 '16 at 08:15
-
Is there a reason not to grab that off of the `@AuthenticationPrincipal`? – chrylis -cautiouslyoptimistic- Dec 12 '16 at 08:17
-
1The `AuthenticationPrincipal` is an instance of `UserDetails`, which does not have the extra details I need. I actually also have a [different issue](http://stackoverflow.com/questions/41086182/how-do-i-map-oauth-2-token-to-userdetails-object-in-a-resource-server) mapping the `AuthenticationPrincipal` to my custom `UserDetails` class. – Psycho Punch Dec 12 '16 at 08:20