All identity providers are flexible and allow you to add custom claims in the issued access token. IdentityServer4 is no different in this scenario. Here is a short manual how to add custom claims in IdentityServer4 access token response.
You need to implement a ProfileService:
public class ProfileService : IProfileService
{
public ProfileService(
UserManager<PafUseruserManager)
{
_userManager = userManager;
}
public async Task GetProfileDataAsync(ProfileDataRequestContext context)
{
var user = await _userManager.GetUserAsync(context.Subject);
var claims = new List<Claim{
new Claim("custom_claim1", user.CustomClaim1),
…
Recent Comments