public static ClaimsPrincipal AddClaim(this ClaimsPrincipal principal, string type, string value, string valueType = "") { var indent = principal.Identities.FirstOrDefault(x => x is CompositionIdentitie); if (indent == null) { indent = new CompositionIdentitie(); principal.AddIdentity(indent); } indent.AddClaim(new Claim(type, value, valueType)); return(principal); }
public static ClaimsPrincipal AddClaim(this ClaimsPrincipal principal, params Claim[] item) { var indent = principal.Identities.FirstOrDefault(x => x is CompositionIdentitie); if (indent == null) { indent = new CompositionIdentitie(); principal.AddIdentity(indent); } foreach (var claim in item) { indent.AddClaim(claim); } return(principal); }