From 95cf90216a49c232a3b51f14fa8524d01be17b02 Mon Sep 17 00:00:00 2001 From: Emilie Date: Fri, 1 Dec 2017 11:03:26 +0100 Subject: [PATCH] [LDAP] : as optionnal authentication --- app/settings.py | 29 +++++++++++++++++++++++++++-- lib/mezzanine-organization | 2 +- requirements.txt | 3 +++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/app/settings.py b/app/settings.py index bddea86a..4126d557 100644 --- a/app/settings.py +++ b/app/settings.py @@ -24,6 +24,8 @@ from __future__ import absolute_import, unicode_literals import os from django.utils.translation import ugettext_lazy as _ +import ldap, logging +from django_auth_ldap.config import LDAPSearch, GroupOfNamesType DEBUG = True if os.environ.get('DEBUG') == 'True' else False @@ -144,8 +146,12 @@ SITE_ID = 1 USE_I18N = True USE_L10N = True -AUTHENTICATION_BACKENDS = ("mezzanine.core.auth_backends.MezzanineBackend", - "guardian.backends.ObjectPermissionBackend",) +AUTHENTICATION_BACKENDS = ( +# Activate Auth LDAP : +# "organization.core.backend.OrganizationLDAPBackend", + "mezzanine.core.auth_backends.MezzanineBackend", + "guardian.backends.ObjectPermissionBackend", +) ######### # PATHS # @@ -599,6 +605,25 @@ if DEBUG : HIJACK_REGISTER_ADMIN = True + +############################################## +########## AUTHENTIFICATION LDAP ########### +############################################## +# You can use LDAP Authentication by using 'Django Auth LDAP'# + +# 1 - Activate logging : +# logging +# if DEBUG: +# logger = logging.getLogger('django_auth_ldap') +# logger.addHandler(logging.StreamHandler()) +# logger.setLevel(logging.DEBUG) + +# 2 - Specify your LDAP settings : +# https://django-auth-ldap.readthedocs.io/en/latest/ + +# 3 - Activate LDAP Backend +# Please see AUTHENTICATION_BACKENDS + ################## # LOCAL SETTINGS # ################## diff --git a/lib/mezzanine-organization b/lib/mezzanine-organization index 2e262b43..0dc91551 160000 --- a/lib/mezzanine-organization +++ b/lib/mezzanine-organization @@ -1 +1 @@ -Subproject commit 2e262b435384f2d266ca3faf1a34a19e99ee2195 +Subproject commit 0dc91551ecadc3b12d5502dcbb16fda0e15bb636 diff --git a/requirements.txt b/requirements.txt index f910c2a5..1553b78f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,3 +10,6 @@ vim ruby ruby-dev gettext +libsasl2-dev +python3-dev +libldap2-dev -- 2.39.5