I made a simple application that use spring security with oauth/jwt provider. I added extra information in jwt token by custom JwtAccessTokenConverter and it works well.
My issue is how gets these extra informations in my Rest Controller.
This is my test:
@RequestMapping(value = "/test", produces = { "application/json" },method = RequestMethod.GET)
public String testMethod(OAuth2Authentication authentication,
OAuth2AccessToken token,
Principal user){
.....
Object a=token.getAdditionalInformation();
Object b=token.getValue();
...
}
The results are:
- OAuth2Authentication: well inject but don't contain additional informations or accesstoken object (it contains only the original jwt token string).
- User is a reference to OAuth2Authentication
- OAuth2AccessToken: is aop proxy without any information infact object A and B are null.
Some extra info:
- I checked,by debug, that ResourceService use my JwtAccessTokenConverter and extract the list of additional information from the access token string in input.