dpgaspar / Flask-AppBuilder

Simple and rapid application development framework, built on top of Flask. includes detailed security, auto CRUD generation for your models, google charts and much more. Demo (login with guest/welcome) - http://flaskappbuilder.pythonanywhere.com/
BSD 3-Clause "New" or "Revised" License
4.7k stars 1.36k forks source link

LDAP problems #1709

Closed perrfect closed 3 years ago

perrfect commented 3 years ago

Flask-Appbuilder version: 3.3.3

Hello I need help wtih LDAP:. I'm getting the error: ERROR:flask_appbuilder.security.manager:{'result': -1, 'desc': "Can't contact LDAP server", 'ctrls': [], 'info': '(unknown error code)'}

My LDAP configuration:

AUTH_TYPE = AUTH_LDAP
AUTH_USER_REGISTRATION = True
AUTH_ROLE_ADMIN = 'Admin'
AUTH_ROLES_MAPPING = { "memberOf=cn=admins,cn=groups,cn=accounts,dc=example,dc=net": ["Admin"] }
AUTH_LDAP_SERVER =  "ldaps://example.net:636"
AUTH_LDAP_USE_TLS = False
AUTH_LDAP_GROUP_FIELD = "memberOf"
AUTH_LDAP_BIND_USER = "uid=forldap,cn=users,cn=accounts,dc=example,dc=net"
AUTH_LDAP_BIND_PASSWORD = "password"
AUTH_LDAP_SEARCH = "cn=users,cn=accounts,dc=example,dc=net"
AUTH_LDAP_SEARCH = "(&(MemberOf=cn=admins,cn=groups,cn=accounts,dc=example,dc=net)(uid=%u)(!(MemberOf=cn=restricted,cn=groups,cn=accounts,dc=example,dc=net)))"
AUTH_LDAP_UID_FIELD = "uid"
perrfect commented 3 years ago

Sorry, the problem solved. A line AUTH_LDAP_SEARCH was wrong. Should be - AUTH_LDAP_SEARCH = "dc=example,dc=net"

dpgaspar commented 3 years ago

nice then, going to close the issue

caxefaizan commented 2 years ago

@perrfect I am facing a similar issue https://github.com/dpgaspar/Flask-AppBuilder/issues/1825 but i tried your solution by keeping only the dc in search base but it still doesn't work. could you look into my issue. thanks