【问题标题】:Executing Bind to LDAP instance using .NET LDAPConnection使用 .NET LDAPConnection 执行绑定到 LDAP 实例
【发布时间】:2021-10-06 21:34:59
【问题描述】:

我正在尝试使用 .NET 对象执行与 LDAP 实例的绑定。 抱歉,这是我第一次与这种敌人作战(希望也是最后一次!)。

这是我实际做的:

LdapDirectoryIdentifier serverId = new LdapDirectoryIdentifier(primaryIP, securePort);
NetworkCredential credentials = new NetworkCredential(username, password);

using (LdapConnection conn = new LdapConnection(serverId, credentials))
{
    try
    {
        //conn.SessionOptions.ProtocolVersion = 3;
        conn.SessionOptions.SecureSocketLayer = true;
        conn.AuthType = (AuthType)authType;
        conn.Bind();
        Console.WriteLine("OK!!");
    }
    catch (LdapException lex)
    {
        Console.WriteLine($"Errore {lex.ErrorCode}: {lex.Message}");
    }
    catch (Exception e)
    {
        Console.WriteLine(e.Message);
    }
}

地点:

  • primaryIP 是 LDAP 实例的名称
  • securePort 是 636
  • 用户名密码绝对正确(我已经检查他们登录到内网)

我找到了很多例子,一切看起来都非常简单明了。反正我过不去。 还尝试了所有可用的 AuthTypes,但没有运气。 如前所述,用户存在是因为我能够登录到使用这种身份验证的不同应用程序。

【问题讨论】:

    标签: c# .net ldap


    【解决方案1】:

    好的,我自己搞定了。 用户名必须设置为完整的 DN。

    现在它可以正常工作了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-09-23
      • 2014-10-20
      • 2019-04-11
      • 1970-01-01
      • 2011-11-20
      • 2015-05-27
      • 1970-01-01
      相关资源
      最近更新 更多