IdentityServer4 icon indicating copy to clipboard operation
IdentityServer4 copied to clipboard

Override Claims in access token for every silent renew

Open muralisambu opened this issue 6 years ago • 3 comments

I'm adding claims from external service when trying to logging to present in access token. I would like to update the claim value for every silent renew. Is overriding the DefaultTokenService is the correct way or do we have any specific class to override?

Thanks in advance

muralisambu avatar May 07 '20 17:05 muralisambu

You should implement your own IProfileService

public async Task GetProfileDataAsync(ProfileDataRequestContext context)
{
    // check for access token
    if (context.Caller == IdentityServerConstants.ProfileDataCallers.ClaimsProviderAccessToken)
    {
        // add custom claims
        context.IssuedClaims.Add(new Claim("mycustomclaim", "newvalue"));
    }
}

crazyfx1 avatar May 11 '20 05:05 crazyfx1

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Questions are community supported only and the authors/maintainers may or may not have time to reply. If you or your company would like commercial support, please see here for more information.

stale[bot] avatar May 25 '20 05:05 stale[bot]

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Nov 27 '20 00:11 github-actions[bot]