cmsmanage/recmaint/settings/prod_base.py

37 lines
879 B
Python
Raw Normal View History

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 = [
2022-01-24 23:37:04 -05:00
"django_auth_ldap.backend.LDAPBackend",
"django.contrib.auth.backends.ModelBackend",
]
AUTH_LDAP_USER_SEARCH = LDAPSearch(
2022-01-24 23:37:04 -05:00
"cn=users,dc=sawtooth,dc=claremontmakerspace,dc=org",
ldap.SCOPE_SUBTREE,
2022-01-24 23:37:04 -05:00
"(uid=%(user)s)",
)
AUTH_LDAP_USER_ATTR_MAP = {
2022-01-24 23:37:04 -05:00
"first_name": "givenName",
"last_name": "sn",
"email": "mail",
}
AUTH_LDAP_GROUP_SEARCH = LDAPSearch(
2022-01-24 23:37:04 -05:00
"cn=groups,dc=sawtooth,dc=claremontmakerspace,dc=org",
ldap.SCOPE_SUBTREE,
2022-01-24 23:37:04 -05:00
"(objectClass=posixGroup)",
)
AUTH_LDAP_GROUP_TYPE = PosixGroupType()
AUTH_LDAP_MIRROR_GROUPS = True