Add values to rest OAuthAccessToken

Hi,

The standard auth token have only this information.

{
“access_token”: “f6b932ca-3c33-436c-ba94-8253a5ed3912”,
“token_type”: “bearer”,
“expires_in”: 43199,
“scope”: “rest-api”
}

and i need something like:

{
“access_token”: “f6b932ca-3c33-436c-ba94-8253a5ed3912”,
“token_type”: “bearer”,
“expires_in”: 43199,
“scope”: “rest-api”,
“foo”:“bar”
}

The product owner want extend this token and include some values, like user name. He wants reduce the quantity of requests, providing basic information about the user in this token.

There are a simple way to do this? I don’t want create a full custom authentication only for this.

Hi!
Do you mean token response from server? It can be done either with custom authentication end-point or with HTTP Filter defined in web.xml that can analyse response from a servlet and modify it if needed. I’d better implement first way, since it is more controllable.