Python 使用Flask\u ldap3\u登录通过LDAP进行Flask身份验证
我正在尝试使用Python 使用Flask\u ldap3\u登录通过LDAP进行Flask身份验证,python,flask,ldap,flask-login,Python,Flask,Ldap,Flask Login,我正在尝试使用Flask\u ldap3\u登录名通过Active Directory验证我的Flask应用程序。我已编写代码来检查与active directory的连接: from flask_ldap3_login import LDAP3LoginManager config = dict() config['LDAP_HOST'] = 'my_ldap_host' config['LDAP_BASE_DN'] = 'dc=internal,dc=com' config['LDAP_
Flask\u ldap3\u登录名
通过Active Directory验证我的Flask应用程序。我已编写代码来检查与active directory的连接:
from flask_ldap3_login import LDAP3LoginManager
config = dict()
config['LDAP_HOST'] = 'my_ldap_host'
config['LDAP_BASE_DN'] = 'dc=internal,dc=com'
config['LDAP_USER_DN'] = 'ou=users'
config['LDAP_GROUP_DN'] = 'ou=groups'
config['LDAP_USER_RDN_ATTR'] = 'cn'
config['LDAP_USER_LOGIN_ATTR'] = 'dn'
config['LDAP_BIND_USER_DN'] = None
config['LDAP_BIND_USER_PASSWORD'] = None
ldap_manager = LDAP3LoginManager()
ldap_manager.init_config(config)
response = ldap_manager.authenticate('username', 'password')
print response.status
当我提供LDAP凭据时,它会抛出错误
raise LDAPOperationResult(result=result['result'], description=result['description'], dn=result['dn'], message=result['message'], response_type=result['type'])
ldap3.core.exceptions.LDAPOperationsErrorResult: LDAPOperationsErrorResult - 1 - operationsError - None - 000004DC: LdapErr: DSID-0C0906E8, comment: In order to perform this operation a successful bind must be completed on the connection., data 0, v1db1 - searchResDone - None
有人能告诉我使用LDAP验证flask应用程序的正确方法吗?您需要提供登录名和密码才能访问LDAP:
app.config['LDAP_BIND_USER_DN'] = 'CN=someUser,CN=Users,DC=domain,DC=local'
app.config['LDAP_BIND_USER_PASSWORD'] = "secretpw"
你让它工作了吗?
代码中有这些行吗?如果你没有,为什么
login\u manager=LoginManager(应用程序)\Flask login manager
ldap_manager=LDAP3LoginManager(app)#设置LDAP3登录管理器我面临同样的问题。