From 73e8bba379be7d4f0c8f97def6109cb3de5b6899 Mon Sep 17 00:00:00 2001 From: Greg Price Date: Tue, 26 Sep 2017 15:56:34 -0700 Subject: [PATCH] ldap auth: Reassure django_auth_ldap our auth-failed exceptions are normal. The main `authenticate` method in the django_auth_ldap package logs a message at `exception` level if it passes through an exception it wasn't expecting. Sensible practice, but we'd been passing through just such an exception for any kind of routine authentication failure. After we recently stopped suppressing an arbitrary subset of loggers with `disable_existing_loggers`, these started showing up noisily, including in tests. So, make our exceptions expected. Just like our own code, the upstream code raises exceptions of a particular type for routine auth failures, and catches them and just returns None. We make our type derive from that one, so as to just piggyback on that behavior. Fixes an issue reported in a comment to #6674. --- zproject/backends.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zproject/backends.py b/zproject/backends.py index ae294e48b1..438166a93e 100644 --- a/zproject/backends.py +++ b/zproject/backends.py @@ -376,7 +376,7 @@ class ZulipRemoteUserBackend(RemoteUserBackend): return None return user_profile -class ZulipLDAPException(Exception): +class ZulipLDAPException(_LDAPUser.AuthenticationFailed): pass class ZulipLDAPAuthBackendBase(ZulipAuthMixin, LDAPBackend):