I'm using the new React template, which is part of the .NET Core 3 release. This template uses Microsoft.AspNetCore.ApiAuthorization.IdentityServer
to integrate ASP.NET Core Identity, IdentityServer and React for user registration, authentication and authorization.
This works really well for simple scenarios, but I find the documentation for a bit more complex scenarios confusing. This is mainly because there are a lot of different cogs now, and it's hard to figure out where to look.
What I want to do is the following: I want to add a custom claim to the user (say, IsAdmin: true
). This claim should be available in the .NET Core HttpContext in the ApiController (as part of the user's claim principal) for auth purposes, and it should be somewhere that React can read this claim (this would probably be the identitytoken/jwt), to provide a good user experience.
What would be a good way to accomplish this?