/// <summary> /// Initializes a new instance of the <see cref="ClaimsPrincipal"/> class with Claims from the Membership User /// </summary> /// <param name="user">Membership User</param> /// <param name="identityProvider">Identity Provider Name</param> /// <param name="claims">List of additional claims</param> /// <returns>Claims Principal</returns> public static ClaimsPrincipal Create(this MembershipUser user, string identityProvider, params Claim[] claims) { var identityServerUser = new IdentityServerUser(user.GetSubjectId()) { DisplayName = user.UserName, IdentityProvider = identityProvider, AdditionalClaims = claims }; return(identityServerUser.CreatePrincipal()); }
/// <summary> /// Initializes a new instance of the <see cref="ClaimsPrincipal"/> class with Claims from the Membership User /// </summary> /// <param name="user">Membership User</param> /// <param name="identityProvider">Identity Provider Name</param> /// <param name="claims">List of additional claims</param> /// <returns>Claims Principal</returns> public static ClaimsPrincipal Create(this MembershipUser user, string identityProvider, params Claim[] claims) { return(IdentityServerPrincipal.Create(user.GetSubjectId(), user.UserName, identityProvider, DateTime.Now, claims)); }