【问题标题】:Is this .Net code using Kerberos or NTLM?这是使用 Kerberos 还是 NTLM 的 .Net 代码?
【发布时间】:2014-05-13 15:44:54
【问题描述】:

我在系统中有以下代码,我正在努力从 MSDN 文档中找出该方法是否将使用 Kerberos 或 NTLM 获取用户组列表。

private static List<SecurityIdentifier> GetUserGroupIds(string user, string groupType, PrincipalContext pc)
{

    using (var identity = UserPrincipal.FindByIdentity(pc, IdentityType.SamAccountName, user))
    {
        if (identity == null)
        {
            return new List<SecurityIdentifier>();
        }

        var userEntry = identity.GetUnderlyingObject() as DirectoryEntry;

        userEntry.RefreshCache(new[] { groupType });

        return (from byte[] sid in userEntry.Properties[groupType]
                select new SecurityIdentifier(sid, 0)).ToList();
    }

}

关于我如何分辨的任何想法?我尝试使用 PerfMon 来捕获 NTLM 和 Kerberos 调用的跟踪,但由于机器上正在运行其他服务,因此很难判断。

【问题讨论】:

  • 我认为网络监视器将是捕获身份验证跟踪的合适工具。特别是因为它已经有一个预定义的“身份验证流量”过滤器

标签: asp.net .net active-directory


【解决方案1】:

我认为DirectoryEntryAuthenticationTypes 属性(在您的情况下为 userEntry 对象)包含必要的信息:
如果该值包含 AuthenticationTypes.Sealing 标志,我认为它正在使用 kerberos。
交叉检查:
当使用用户名和密码获取DirectoryEntry 对象时,使用以下代码new DirectoryEntry("LDAP://DC=aaa,DC=bbb,DC=ccc,DC=ddd", "{userName}", "{password}"); 上述标志设置为AuthenticationTypes.Secure

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-10-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-18
    • 1970-01-01
    • 1970-01-01
    • 2017-07-24
    相关资源
    最近更新 更多