Python3 LDAP3 NTLM 有效,但默认身份验证方案返回 invalidCredentials

问题描述

我正在使用带有 ldap3 库和 Active Directory 的 python 3.6.12。 这是我的代码片段:

    #user = f'cn={ldap_username},OU=User-Accounts,{root_dn}' # Failed with invalidCredentials
    user = f'{ldap_username}' # Success
    print(user)
    server = Server(ldap_server,get_info=ALL)
    connection = Connection(server,user=user,password=ldap_password,authentication=NTLM)
    if not connection.bind():
        print(f" *** Cannot bind to ldap server! {connection.last_error},result: {connection.result}")
        l_success_msg = f' ** Failed Authentication: {connection.last_error}'
    else:
        print(f" *** Successful bind to ldap server")
        l_success_msg = 'Success'
cn=username,DC=domain,DC=com
{'result': 49,'description': 'invalidCredentials','dn': '','message': '80090308: LdapErr: DSID-0C090446,comment: AcceptSecurityContext error,data 52e,v2580\x00','referrals': None,'saslCreds': None,'type': 'bindResponse'}

简单的身份验证方案有什么问题?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)