库以及到活动目录的连接

库以及到活动目录的连接

本文介绍了dartlang 和 dartdap 库以及到活动目录的连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为 Dart 寻找一个好的 ldap 库来连接 Microsoft Active Directory.我找到了 dartdap,但我似乎无法让它工作.我 100% 确信我的 CN 和密码是正确的,因为我可以使用 lpap 浏览器连接到 Active Directory.

I was looking for a good ldap library for Dart for connecting Microsoft Active Directory. I found dartdap, but I can't seem to get it working. I'm 100% shure that my CN and password is correct, because I can connect to Active directory for example with lpap browser.

我得到的错误是:未捕获的错误:无效凭据 (49) msg​​=80090308:LdapErr:DSID-0C0903A9,注释:AcceptSecurityContext 错误,数据 52e,v1db1

The error I get is:Uncaught Error: Invalid Credentials (49) msg=80090308: LdapErr: DSID-0C0903A9, comment: AcceptSecurityContext error, data 52e, v1db1

ldap.yaml 看起来像这样(地址、密码和用户名乱码)

The ldap.yaml looks like this (address, password and username scrambled off course)

# LDAP configuration file
# default is used if no connection name is specified
default:
  port: 389
  host: xxx.xx.com
  bindDN: cn=testaccount
  password:  xxxxxxxx

ldaptest.dart 看起来像这样:

And the ldaptest.dart looks like this:

void readDataFromLDAPServer() {
  var ldapConfig = new LDAPConfiguration("ldap.yaml","default");
  var attrs = ["dn", "cn", "objectClass"];
  var filter = Filter.substring("cn=A*");
  var notFilter = Filter.not(filter);

  ldapConfig.getConnection().then( (LDAPConnection ldap) {
    ldap.search("dc=example,dc=com", filter, attrs).
    listen( (SearchEntry entry) => print('Found $entry'));

    // we expect to find non A entries
    ldap.search("dc=example,dc=com", notFilter, attrs)
      .listen( (SearchEntry entry) {
        //print("Not search = ${entry}");
        // todo: test entries.
      });

  });

}

任何想法,可能有什么问题?

Any idea, what might be wrong?

推荐答案

我正在使用下面的代码成功绑定到 Microsoft AD 服务器:

I am using the code below to successfully bind to a Microsoft AD server:

  var host = "ip_address";
  var ssl = false;
  var port = null;
  var bindDN = "[email protected]";
  var password = "password";

  var connection = new LdapConnection(host: host);
  connection.setProtocol(ssl, port);
  connection.setAuthentication(bindDN, password);

请注意,我的绑定代码与您使用的不同.我还在 Dart 2 中使用 an_ldap 客户端.

Please note that my binding code differs from what you are using. I am also using an_ldap client for Dart 2.

这篇关于dartlang 和 dartdap 库以及到活动目录的连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 19:36