import ldap from django_auth_ldap.config import LDAPSearch, GroupOfNamesType AUTH_LDAP_SERVER_URI = "ldaps://foo.example.com ldaps://bar.example.com" AUTH_LDAP_BIND_DN = "cn=foo,ou=bar,dc=example,dc=com" AUTH_LDAP_BIND_PASSWORD = "foobar" AUTH_LDAP_USER_SEARCH = LDAPSearch( "ou=foo-users,dc=example,dc=com", ldap.SCOPE_ONELEVEL, "(&(uid=%(user)s)(objectClass=nsPerson)(|(memberOf=cn=foo_access,ou=bar,dc=example,dc=com)(memberOf=cn=foo_staff,ou=bar,dc=example,dc=com)(memberOf=cn=foo_admins,ou=bar,dc=example,dc=com)))" ) AUTH_LDAP_USER_ATTR_MAP = { "first_name": "givenName", "last_name": "sn", "full_name": "legalName", "email": "mail", } AUTH_LDAP_GROUP_TYPE = GroupOfNamesType() AUTH_LDAP_GROUP_SEARCH = LDAPSearch( "ou=bar,dc=example,dc=com", ldap.SCOPE_ONELEVEL, "(&(objectClass=groupOfNames)(|(cn=foo_access)(cn=foo_staff)(cn=foo_admins)))" ) AUTH_LDAP_REQUIRE_GROUP = "cn=foo_access,ou=foo_groups,dc=syscid,dc=com" AUTH_LDAP_MIRROR_GROUPS = True AUTH_LDAP_USER_FLAGS_BY_GROUP = { "is_active": "cn=foo_access,ou=foo_groups,dc=example,dc=com", "is_staff": "cn=foo_staff,ou=foo_groups,dc=example,dc=com", "is_superuser": "cn=foo_admins,ou=foo_groups,groups,dc=example,dc=com" } AUTH_LDAP_FIND_GROUP_PERMS = True AUTH_LDAP_CACHE_TIMEOUT = 3600