Q: Setting primary identity in ClaimsPrincipal.Current How to change in ClaimsPrincipal.Current identity collection the primary one identity ?
I saw there is ClaimsPrincipal.PrimaryIdentitySelector, but I am not sure when it is fired and how it have to work.
As I sow I can only add a new one ClaimIndetity to the collection, but I can not set it as primary. If I can not do that then default Account control in MVC does not see provided user name .
Thank you,
Rastko

A: If you have multiple Identities, and lets say only one of them has a name claim. You could do this.
public class MyPrincipal : ClaimsPrincipal
{
    public MyPrincipal() 
    {
        PrimaryIdentitySelector = (ids) => ids.FirstOrDefault(id => id.Name == ClaimTypes.Name);
    }
}

}
