2020-12-22 01:10:39 -05:00
|
|
|
import ldap
|
|
|
|
from django_auth_ldap.config import LDAPSearch, PosixGroupType
|
|
|
|
|
2020-12-18 14:09:11 -05:00
|
|
|
from .base import *
|
|
|
|
|
|
|
|
DEBUG = False
|
2020-12-22 01:10:39 -05:00
|
|
|
|
|
|
|
|
|
|
|
# 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 = [
|
2022-01-24 23:37:04 -05:00
|
|
|
"django_auth_ldap.backend.LDAPBackend",
|
|
|
|
"django.contrib.auth.backends.ModelBackend",
|
2020-12-22 01:10:39 -05:00
|
|
|
]
|
|
|
|
|
|
|
|
AUTH_LDAP_USER_SEARCH = LDAPSearch(
|
2022-01-24 23:37:04 -05:00
|
|
|
"cn=users,dc=sawtooth,dc=claremontmakerspace,dc=org",
|
2020-12-22 01:10:39 -05:00
|
|
|
ldap.SCOPE_SUBTREE,
|
2022-01-24 23:37:04 -05:00
|
|
|
"(uid=%(user)s)",
|
2020-12-22 01:10:39 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
AUTH_LDAP_USER_ATTR_MAP = {
|
2022-01-24 23:37:04 -05:00
|
|
|
"first_name": "givenName",
|
|
|
|
"last_name": "sn",
|
|
|
|
"email": "mail",
|
2020-12-22 01:10:39 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
AUTH_LDAP_GROUP_SEARCH = LDAPSearch(
|
2022-01-24 23:37:04 -05:00
|
|
|
"cn=groups,dc=sawtooth,dc=claremontmakerspace,dc=org",
|
2020-12-22 01:10:39 -05:00
|
|
|
ldap.SCOPE_SUBTREE,
|
2022-01-24 23:37:04 -05:00
|
|
|
"(objectClass=posixGroup)",
|
2020-12-22 01:10:39 -05:00
|
|
|
)
|
|
|
|
AUTH_LDAP_GROUP_TYPE = PosixGroupType()
|
|
|
|
AUTH_LDAP_MIRROR_GROUPS = True
|