ametaireau/django-auth-ldap — pull request #2 by ryangallen (2014-07-01 18:55:36+00:00)
Title: Search for user DN when BIND_AS_AUTHENTICATING_USER=True

I needed to do this to get user attrs when logging in with an account name. It's a simple fix but I'm not sure it's the best way to go about it. Would like to open up the discussion and possibly implement.

BIND_AS_AUTHENTICATING_USER = True
AUTH_LDAP_USER_DN_TEMPLATE = "%(user)s@your.domain"
AUTH_LDAP_USER_SEARCH = LDAPSearch(
"ou=USERS,dc=your,dc=domain",
ldap.SCOPE_SUBTREE,
"(sAMAccountName=%(user)s)"
)