Add sub to Profile model
vitalybrandes opened this issue · comments
Summary
Can you please "Sub" to Profile model
https://identityserver4.readthedocs.io/en/latest/endpoints/userinfo.html
We are reviewing if it is convenient that we can add this property to the profile model permanently, but we are not sure yet.
We are designing a better way to extend claim mapping approach.
In the meantime, you can your custom profile model like this one:
public class ProfileWithSub : Profile
{
[ClaimType("sub")]
[JsonPropertyName("sub")]
public string Sub
{
get;
set;
}
}
The User class is generic, so you can retrieve the profile using your custom class in this way:
User<ProfileWithSub> user = await UserManager.GetUserAsync();
Perfect, thanks!