【问题标题】:Unable to connect to ldap using python ldap3 module无法使用 python ldap3 模块连接到 ldap
【发布时间】:2023-03-10 06:11:02
【问题描述】:

我正在使用在线 LDAP 测试服务器(https://www.forumsys.com/tutorials/integration-how-to/ldap/online-ldap-test-server/)

我正在尝试使用 python ldap3 模块连接到它。

这是我的代码:

import ldap3
user = 'riemann'
password = 'password'
server = ldap3.Server('ldap.forumsys.com', port=389)
connection = ldap3.Connection(server, user=user, password=password)
connection.bind()
conn = connection.search(search_base='ou=mathematicians,dc=example,dc=com', search_filter='(&(objectClass=user)(userPrincipalName='+user+'))', attributes='*')

print conn

当我检查 conn 时,它是 False

有人可以帮我建立连接吗 提前致谢

【问题讨论】:

标签: python ldap openldap python-ldap ldap3


【解决方案1】:

如果您将user='riemann' 更改为user='uid=riemann,dc=example,dc=com',您将获得连接

有关更多信息,请查看文档:http://ldap3.readthedocs.io/bind.html#simple-bind

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-09
    • 1970-01-01
    • 1970-01-01
    • 2017-10-26
    • 2015-09-20
    相关资源
    最近更新 更多