【问题标题】:Connect to eDirectory using application credentials. Then authenticate user使用应用程序凭据连接到 eDirectory。然后验证用户
【发布时间】:2017-04-26 16:28:58
【问题描述】:

我需要使用 .NET 和 C# 连接到 NetIQ eDirectory。必须使用应用程序凭据打开连接。打开连接后,我需要使用与 S.DS.AccountManagement 类似的方法在应用程序凭据的权限下验证用户凭据。

        using (var context = new PrincipalContext(ContextType.Domain, path, appUserDn, appPassword))
        {
            //Username and password for authentication.
            var valid = context.ValidateCredentials(userDn, password);
        }

我尝试了 Novell.Directory.Ldap、S.DS.DirectoryEntry 和 S.DS.AccountManagement。最后一个需要AD,不适用。

使用 Novell.Directory.Ldap 进行测试..

        using (var cn = new LdapConnection())
        {
            cn.Connect(server, int.Parse(port));
            cn.Bind(appUserDn, appPassword); //throws exception if invalid credentials..
            var passwordAttr = new LdapAttribute("userPassword", password);
            cn.Compare(userDn, passwordAttr); // Only compares password, so no locked account check, etc.
        }

我当前的原型使用 S.DS.Protocols。

        var networkCredential = new NetworkCredential(
            appUserDn,
            appPassword);

        using (proto.LdapConnection cn = new proto.LdapConnection(new proto.LdapDirectoryIdentifier(server, int.Parse(port)), networkCredential, proto.AuthType.Basic))
        {
            cn.Bind();

            /// Next validate user credentials..

        }

除了重新分配 NetworkCrentials 并使用个人的用户名和密码重新绑定之外,我找不到验证用户凭据的方法。我应该如何进行?

【问题讨论】:

    标签: c# .net ldap edirectory


    【解决方案1】:

    事实证明我们的客户弄错了。正确的方法是将连接直接绑定到个人的凭据,正如我在 Novell.Directory.Ldap 示例中所演示的那样。

    在 NetIQ 的论坛上有一篇关于执行 shell 脚本的帖子,但我没有得到它的工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-07-21
      • 2015-10-30
      • 1970-01-01
      • 2013-02-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多