我正在使用flask_simpleldap并正在努力获得一个绑定连接来执行任何有用的操作。在
我的LDAP服务器是active directory。在
精简后的代码如下所示,与the example几乎相同:
from flask import Flask
from flask_simpleldap import LDAP
app = Flask(__name__)
app.secret_key = 'super secret key'
app.debug = True
app.config['LDAP_HOST'] = 'my-ldap-host.example.com'
app.config['LDAP_REALM_NAME'] = 'LDAP Authentication'
app.config['LDAP_SCHEMA'] = 'ldaps'
app.config['LDAP_PORT'] = 636
app.config['LDAP_BASE_DN'] = 'dc=example,dc=com'
app.config['LDAP_USERNAME'] = 'binduser@example.com'
app.config['LDAP_PASSWORD'] = 'binduser_pw'
app.config['LDAP_OBJECTS_DN'] = 'distinguishedName'
app.config['LDAP_OPENLDAP'] = False
ldap = LDAP(app)
@app.route('/ldap')
@ldap.basic_auth_required
def ldap_protected():
return 'Welcome, {0}!'.format(g.ldap_username)
if __name__ == '__main__':
app.run(host='0.0.0.0', port=8080, debug=True)
当这个应用程序运行时,我会得到这样一个错误:
^{pr2}$在尝试故障排除时,我修改了flask_simpleldap
__init__.py
文件,在line 274上显示info
以及错误的{
LDAPException: 000004DC: LdapErr: DSID-0C090752,
comment: In order to perform this operation a successful bind must be completed on the connection., data 0, v2580
所以,我想我需要理解的是为什么我的初始绑定不起作用。。。我的app.config
有什么问题吗?在
不知道问题是什么。。。ldapsearch
似乎在shell中工作:
ldapsearch -x -LLL -E pr=200/noprompt -h my-ldap-host.example.com -D "binduser@example.com" -w 'binduser_pw' -b "dc=example, dc=com" -s sub "(sAMAccountName=binduser)" | grep distinguishedName
distinguishedName: CN=Bind User,OU=Some_OU,DC=example,DC=com
其他详细信息:
感谢任何帮助,谢谢。在
不确定这是否有用,但我已经设置了
flask_simpleldap
来处理我们的测试活动目录实例。唯一相关的区别是我必须使用:我想我也看到了“操作错误”当我有无效的DN或用户名格式。在
您的用户名必须是完全限定的。在
相关问题 更多 >
编程相关推荐