简体   繁体   English

是否可以使用python ldap3连接到eDirectory?

[英]Is it possible to connect to eDirectory with python ldap3?

I am trying to connect to eDirectory using python. 我正在尝试使用python连接到eDirectory。 It is not as easy as connecting to active directory using python so I am wondering if this is even possible. 它不像使用python连接到活动目录那样容易,所以我想知道这是否有可能。 I am currently running python3.4 我目前正在运行python3.4

I'm the author of ldap3, I use eDirectory for testing the library. 我是ldap3的作者,我使用eDirectory测试该库。

just try the following code: 只需尝试以下代码:

from ldap3 import Server, Connection, ALL, SUBTREE
server = Server('your_server_name', get_info=ALL)  # don't user get_info if you don't need info on the server and the schema
connection = Connection(server, 'your_user_name_dn', 'your_password')
connection.bind()
if connection.search('your_search_base','(objectClass=*)', SUBTREE, attributes = ['cn', 'objectClass', 'your_attribute'])
    for entry in connection.entries:
        print(entry.entry_get_dn())
        print(entry.cn, entry.objectClass, entry.your_attribute)
connection.unbind()

If you need a secure connection just change the server definition to: 如果需要安全连接,只需将服务器定义更改为:

server = Server('your_server_name', get_info=ALL, use_tls=True)  # default tls configuration on port 636

Also, any example in the docs at https://ldap3.readthedocs.org/en/latest/quicktour.html should work with eDirectory. 此外,文档中https://ldap3.readthedocs.org/en/latest/quicktour.html上的任何示例都可以与eDirectory一起使用。

Bye, Giovanni 再见,乔瓦尼

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM