Flask-login和LDAP身份验证

时间:2014-04-28 06:31:29

标签: python flask ldap

我无法连接到以下LDAP测试服务器。每个输入或建议都表示赞赏。

LDAP服务器信息

Server: ldap.forumsys.com  
Port: 389

Bind DN: cn=read-only-admin,dc=example,dc=com
Bind Password: password

所有用户密码均为password

individual Users (uid) and Group (ou) 

ou=mathematicians,dc=example,dc=com
riemann
gauss
euler
euclid

烧瓶

@app.route('/')
def index():
    l = ldap.open("ldap.forumsys.com", port=389)
    username = "uid=einstein,ou=scientists,dc=example,dc=com"
    password = "password"
    try:
      l.protocol_version = ldap.VERSION3
      l.simple_bind_s(username, password)
      return "hi"

    except Exception, error:
      return "no"

1 个答案:

答案 0 :(得分:0)

我也遇到了同样的问题,我修改如下:

使用 l.simple_bind(用户名,密码) 代替 l.simple_bind_s(用户名,密码)

相关问题