📜  c# .net RemoveClaim auth - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:38.885000             🧑  作者: Mango

代码示例1
var claimNameList = identity.Claims.Select(x => x.Type).ToList();

        foreach (var name in claimNameList)
        {
            if (!name.Equals("UserAccountId") && !name.Equals("Email") && !name.Equals("TenantIds"))
            {
                var claim = identity.Claims.FirstOrDefault(x => x.Type == name);
                if (claim != null)
                    identity.RemoveClaim(claim);
            }
        }