We are currently developing an API and IdentityServer with IdentityServer4 github project :
Github repository : https://github.com/IdentityServer/IdentityServer4
Documentation : https://identityserver4.readthedocs.io/en/latest/
And we are thinking about the most efficient and secure way for the API server, or Service Provider (SP) to communicate with the identity Server, or Identity Provider (IdP). We haven't found a lot of informations yet.
This diagram shows us :
That the Service Provider (SP) asks for the Identity Provider (IdP) the User Info (step 5 : User Info retrieval)
(Source : https://www.researchgate.net/figure/OpenID-Connect-Authorization-Code-Flow_fig1_320282638 )
- How does the SP asks those informations to the IdP ? Does he, for example, send an HTTP Post "token-info" containing the access token sent by the User ?
- If so, how does the IdP understands that this request comes from the SP ?
We suppose we can :
- use a specific SSL Certificate between the IdP and the SP and validate it somehow,
- and also RSA Sign the hash of the access token with a certificate known by the IdP ?
We also thought about :
- registering the SP itself as a specific client of the IdP and a specific claim,
- This claim is only given to the SP, and allows it to send a request to ask for user information regarding an access token
- Furthermore, has the SP the ability to store the informations of the user regarding the access token given and previously sent to the IdP (in a dictionary of AccessToken / User Infos) with a limited amount of time, equal to the duration of the access token ? This would prevent the Service Provider to constantly ask for user information from an access token if a resource is consumed a certain amount of times during the validity of the access token
We can provide code as well, but we believe this problem is mainly an architectural issue.