import ldap from django_auth_ldap.config import LDAPSearch, PosixGroupType from .base import * DEBUG = False # LDAP Authentication # https://django-auth-ldap.readthedocs.io/en/latest/ # "AUTH_LDAP_SERVER_URI", "AUTH_LDAP_BIND_DN", and "AUTH_LDAP_BIND_PASSWORD" set in prod.py AUTHENTICATION_BACKENDS = [ 'django_auth_ldap.backend.LDAPBackend', 'django.contrib.auth.backends.ModelBackend', ] AUTH_LDAP_USER_SEARCH = LDAPSearch( 'cn=users,dc=sawtooth,dc=claremontmakerspace,dc=org', ldap.SCOPE_SUBTREE, '(uid=%(user)s)', ) AUTH_LDAP_USER_ATTR_MAP = { 'first_name': 'givenName', 'last_name': 'sn', 'email': 'mail', } AUTH_LDAP_GROUP_SEARCH = LDAPSearch( 'cn=groups,dc=sawtooth,dc=claremontmakerspace,dc=org', ldap.SCOPE_SUBTREE, '(objectClass=posixGroup)', ) AUTH_LDAP_GROUP_TYPE = PosixGroupType() AUTH_LDAP_MIRROR_GROUPS = True