python-3.6 - 在 LDAP3 中获取 connection.bind 的 invalidCredentials
问题描述
我正在尝试编写将使用 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'}
我确定我使用的用户名和密码是正确的。你能告诉代码有什么问题吗?
解决方案
我不得不谷歌它,但最终,下面的代码工作:
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)
推荐阅读
- javascript - Angular 10 --proxy.conf 没有将请求重定向到目标
- spring - 在 MongoDB 中搜索,条件是每个属性只能得到一个结果,最高版本
- android - 从后台恢复时如何重新启动 nativescript 应用程序?
- r - 直接从 FRED 网站提取数据以在 R 中创建数据框
- google-cloud-platform - 加载操作中的 GCP Bigquery 错误:缺少字节
- java - java.lang.NoClassDefFoundError: org/apache/commons/codec/binary/Base64: 来自使用 Maven 导入的库 jar
- swift - SwiftUI:视图短暂闪烁白色
- r - 交叉两组坐标以计算最小距离?(tidyr geosphere R)
- angular - 复选框上的角度绑定不适用于模型
- macos - 如何在 macOS 上让 Android 模拟器全屏显示?