nickw444 / flask-ldap3-login

LDAP3 Logins for Flask/Flask-Login
http://flask-ldap3-login.readthedocs.org/en/latest/
MIT License
73 stars 38 forks source link

ERROR:flask_ldap3_login:invalid class in objectClass attribute: group #53

Closed StasTODD closed 5 years ago

StasTODD commented 5 years ago

Hello! I set up a simple project with authorization on flask. First of all, to test connectivity with LDAP, I try the Basic Application from a resource: https://flask-ldap3-login.readthedocs.io/en/latest/quick_start.html My LDAP is 100% working. After requesting the Basic Application to the LDAP server, I see that the LDAP server returns "success", but flask gives the error.

Please help me where and how to see what LDAP returns to me and how to solve the problem?

Error:

  Serving Flask app "run_auth_test" (lazy loading)   Environment: production    WARNING: Do not use the development environment.    Use a production WSGI server instead.   Debug mode: on   Running on http://127.0.0.1:5000/ (Press CTRL + C to quit)   Restarting with stat   Debugger is active!  * Debugger PIN: 201-317-530

127.0.0.1 - - [07 / Jan / 2019 19:51:30] "GET / login HTTP / 1.1" 200 - ERROR: flask_ldap3_login: invalid class in objectClass attribute: group 127.0.0.1 - - [07 / Jan / 2019 19:51:41] "POST / login HTTP / 1.1" 200 - INFO: werkzeug: 127.0.0.1 - - [07 / Jan / 2019 19:51:41] "POST / login HTTP / 1.1" 200 -

nickw444 commented 5 years ago

ERROR: flask_ldap3_login: invalid class in objectClass attribute: group

I just did a quick search, this looks like an issue being thrown from the underlying ldap3 library that is used under the hood. Looks like it is coming from here:

https://github.com/cannatag/ldap3/blob/166e77ee32fd0a7ef5c7715eb62eaa0784589b13/ldap3/protocol/convert.py#L156-L158

soaggarw commented 5 years ago

Is that because 'group' is not a valid objectclass in LDAP. Try checking objectclass attributes in your group ou (could be one of groupOfNames, groupOfUniqueNames, nisNetGroup, posixGroup) and set that to config LDAP_GROUP_OBJECT_FILTER. example - LDAP_GROUP_OBJECT_FILTER="(objectclass=groupOfNames)"

StasTODD commented 5 years ago

Yeah, it work! I fix it: app.config['LDAP_GROUP_OBJECT_FILTER'] = '(objectclass=posixGroup)'