A client receive an valid access_token, I would like to know if i can do it with OAuth2/OpenID:
Many examples on internet show that /userinfo request is done by the "client" to access some user informations.
So how to allow access to /userinfo only from ressourceserver ?
The ressourceserver has an "access token" in input. How to use this access_token to access sensitive information without allow "client" to acces this information ?
I did two schema to explained:
Userinfo endpoint
is a service provided by your Identity provider (IdP). It's a part of OAuth spec - http://openid.net/specs/openid-connect-core-1_0.html#UserInfo. It depends on IdP configuration, what is exposed in userinfo response.
So, don't expose contract_ID
in userinfo endpoint, but create some API method getcontractid
, which will be authenticated/authorized API method and it will retrieve contract ID from your DB.