From ea4682e78286644c3c133fa22cbcf0636cfdf2dc Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Mon, 6 Feb 2017 15:58:47 -0500 Subject: [PATCH] catch and log LDAP auth plugin misconfigurations see: #5204 --- awx/sso/backends.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/awx/sso/backends.py b/awx/sso/backends.py index 591b3ab988..64ac84b96f 100644 --- a/awx/sso/backends.py +++ b/awx/sso/backends.py @@ -10,6 +10,7 @@ from django.dispatch import receiver from django.contrib.auth.models import User from django.conf import settings as django_settings from django.core.signals import setting_changed +from django.core.exceptions import ImproperlyConfigured # django-auth-ldap from django_auth_ldap.backend import LDAPSettings as BaseLDAPSettings @@ -75,7 +76,11 @@ class LDAPBackend(BaseLDAPBackend): if not feature_enabled('ldap'): logger.error("Unable to authenticate, license does not support LDAP authentication") return None - return super(LDAPBackend, self).authenticate(username, password) + try: + return super(LDAPBackend, self).authenticate(username, password) + except ImproperlyConfigured: + logger.error("Unable to authenticate, LDAP is improperly configured") + return None def get_user(self, user_id): if not self.settings.SERVER_URI: