I'm using django-auth-ldap with following setting because there is no default/global 'admin' user on the ldap server, its only for authenticating users and users themselves may see their user information.
AUTH_LDAP_BIND_AS_AUTHENTICATING_USER=True
in django-ldap-debug.log i get following error when (as logged in user) calling in view LDAPBackend().populate_user(request.user.username)
search_s('uid=vchrizz,ou=Users,dc=funkfeuer,dc=at', 0, '(objectClass=*)') raised NO_SUCH_OBJECT({'desc': 'No such object'},)
search_s('uid=vchrizz,ou=Users,dc=funkfeuer,dc=at', 0, '(objectClass=*)') returned 0 objects:
only when logging in (using login_required from django.contrib.auth.decorators) it returns a user object it seems:
search_s('uid=vchrizz,ou=Users,dc=funkfeuer,dc=at', 0, '(objectClass=*)') returned 1 objects: uid=vchrizz,ou=users,dc=funkfeuer,dc=at
then i noticed, i need to set
AUTH_LDAP_BIND_DN
AUTH_LDAP_BIND_PASSWORD
to get rid of the error, but first i dont want to specify a user with password (cause bind_as_authenticating_user) and second populate_user() still returns NoneType ...
why? how do i get the returned user information from ldap?
my goal is to display all ldap user information like uidNumber from the ldap-user in my custom /userinfo/ view. http://pastebin.com/VqGiwzFE
thanks, chris
user = auth.authenticate(username="theuser", password="thepass")naturally i dont want hardcoded user credentials here, so i can replace "theuser" withrequest.user.usernamebut not the password asrequest.user.passwordis the hashed password. as the password is in /login/ view in POST, i guess its better to get the (authenticated) user object from /login/ view into /userinfo/ view? but how do i do that? - vchrizz