未能将自定义声明添加到ClaimsIdentity

时间:2016-08-03 17:45:51

标签: c# claims-based-identity claims

我正在努力为我在别处创建的自定义主体添加自定义声明。问题是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);

0 个答案:

没有答案