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.
This commit is contained in:
Greg Price
2017-09-26 15:56:34 -07:00
committed by Tim Abbott
parent b340b28055
commit 73e8bba379

View File

@@ -376,7 +376,7 @@ class ZulipRemoteUserBackend(RemoteUserBackend):
return None return None
return user_profile return user_profile
class ZulipLDAPException(Exception): class ZulipLDAPException(_LDAPUser.AuthenticationFailed):
pass pass
class ZulipLDAPAuthBackendBase(ZulipAuthMixin, LDAPBackend): class ZulipLDAPAuthBackendBase(ZulipAuthMixin, LDAPBackend):