WildGums / Blorc.OpenIdConnect

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add sub to Profile model

vitalybrandes opened this issue · comments

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!