Improve ability to debug reason for auth failure (e.g. logging)
See original GitHub issueThis is related to #284. It took us a long time and a lot of debugging sessions with our customer to figure out why LDAP auth was not working for them. It turns out that multiple results were being returned from the user search, and due to the if results is not None and len(results) == 1
condition in backend._LDAPUser._search_for_user_dn
, that fails.
Of course, that should fail, but it should be easier to figure out why it is failing. Can we have logging of the cause of a login failure, including at this and at other places in the process? Successful logins are might also be useful to have in the log when trying to review a the history of a debugging session.
Perhaps, login successes and failures could be logged as INFO and details about the reason for a login failure could be logged as DEBUG.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Thanks. I will submit a PR.
I also wanted to get more insight into what’s going on. I found that
python-ldap
was able to log every single request (and response) that it makes by usingtrace_level
andtrace_file
(see ldap.initialize docs).I used this bit of code to both turn up
ldap
verbosity and pipe it through thelogging
system:(apologies if there are unused imports, this is part of a larger module).
IMO
_TraceFileLogging
should be added upstream inpython-ldap
– andpython-ldap
should really just use the standardlogging
system.