add extra claims
i need to add couple of custom extra claims to claims list before sending the response to client (cliams of : job,friend , etc)
should i make a custom implementation of IProfileService but dont work
public class MyProfileService : IProfileService
{
public async Task GetProfileDataAsync(ProfileDataRequestContext context)
{
IEnumerable
context.AddFilteredClaims(context.Subject.Claims);
}
public Task IsActiveAsync(IsActiveContext context)
{
context.IsActive = true;
return Task.FromResult(0);
}
}
Did you inject your profile service into pipeline? Like below: builder.Services.AddTransient<IProfileService, MyProfileService >();
Yes I did it and it works.also breakpoints get hit.but I don't see extra claims on mvcclient user claims
You need to have an ApiResource, like new ApiResource("basicinfo", new []{ JwtClaimTypes.AuthenticationTime } ) , and related it in AllowedScopes in Client.
..........
ClientSecrets =
{
new Secret("secret".Sha256())
},
RequireClientSecret = false,
AllowedScopes = new List<string>
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
"basicinfo",
}
Please try it.
thank u very much but this dont work, im using identityServer4 rc5 and things are different here
IdentityServer4 v1.0.0 was released last week. I suggest you update to it.
Im using identity server 4 and have followed the instructions here and for the life of me I cannot get it to hit any breakpoints in the custom profile service.
Yes I registered it at start up
Yes I added claims to the ApiResource
What am i missing?
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.