获取LDAP3中的connection.bind的无效凭据

问题描述 投票:0回答:1

我正在尝试编写将使用LDAP模块来验证LDAP连接的python代码:

import configuration
from ldap3 import Server, Connection, SIMPLE, SYNC, ALL

server = Server(configuration.LDAP_SERVER, port=XXXX, get_info=ALL)
c = Connection(server, authentication=SIMPLE, user=configuration.LDAP_USER, password=configuration.LDAP_PASS, check_names=True, lazy=False, client_strategy=SYNC, raise_exceptions=False)
c.open()
c.bind()

运行代码时,我得到:

{'result': 49, 'description': 'invalidCredentials', 'dn': '', 'message': '80090308: LdapErr: DSID-0C09042A, comment: AcceptSecurityContext error, data 52e, v3839\x00', 'referrals': None, 'saslCreds': None, 'type': 'bindResponse'}

我确定我使用的用户名和密码正确。你能告诉我代码有什么问题吗?

python-3.6 credentials ldap3
1个回答
0
投票
我必须用Google搜索,但最终,以下代码起作用了:

import configuration from ldap3 import Server, Connection, SIMPLE, SYNC, ALL server = Server(configuration.LDAP_SERVER, get_info=ALL) conn = Connection(server, "CN=XXXXX,OU=XXX;OU=XXXX,OU=Users,XX=People,XX=corp,XX=amdocs,XX=XXX", password=configuration.LDAP_PASS, auto_bind=False) conn.bind() print(conn)

© www.soinside.com 2019 - 2024. All rights reserved.