我正在努力为我在别处创建的自定义主体添加自定义声明。问题是ci.Claims在调用AddClaims后不包含任何内容。哪个很烦人。任何提示?
System.Security.Claims.Claim cl = new Claim ( "http://myfoo.com/claims/correlationid", "correlationid");
var identity = principal.Identity; // this is a custom principal
var ci = new System.Security.Claims.ClaimsIdentity(identity);
var list = new List<Claim>();
list.Add(cl);
ci.AddClaims(list);
principal.AddIdentity(ci);