'Adding new Claims after authentication

I have the following environment

  • IdentityServer 4 (STS)
  • ASP.NET (Web API)
  • Angular (SPA)

My goal is that after authentication in IS4, the user will be returned to the SPA application and also there will be an additional request to the Web API, to provide additional Claims. The values of these Claims will depend on what is currently in the database to which the Web API is connected. I need these Claims in future to allow access to certain APIs

I know that this can be done through ProfileService. But in this case IS4 should be a part of Web API (which I can't do by requirement)

How should I do it right?

I had an idea to create in my Web API a new endopit, which will return a set of Claim. And these Claims I will store on the SPA side of the application in localstorage. But this doesn't seem very safe to me, because anyone can change these Claims



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source