1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
import ldap from django_auth_ldap.config import LDAPSearch, GroupOfNamesType, PosixGroupType
AUTHENTICATION_BACKENDS = [ 'django_auth_ldap.backend.LDAPBackend', 'django.contrib.auth.backends.ModelBackend', ]
AUTH_LDAP_SERVER_URI = configs['ldap']['ldhost']
AUTH_LDAP_BIND_DN = "cn=root,dc=vcg,dc=com" AUTH_LDAP_BIND_PASSWORD = '*****'
AUTH_LDAP_USER_SEARCH = LDAPSearch( "ou=People,dc=vcg,dc=com", ldap.SCOPE_SUBTREE, "(cn=%(user)s)" )
AUTH_LDAP_USER_ATTR_MAP = { "first_name": "givenName", "last_name": "sn", "email": "mail", }
AUTH_LDAP_GROUP_SEARCH = LDAPSearch( "ou=Group,dc=vcg,dc=com", ldap.SCOPE_SUBTREE, "(objectClass=posixGroup)" ) AUTH_LDAP_GROUP_TYPE = PosixGroupType(name_attr="cn")
AUTH_LDAP_REQUIRE_GROUP = "cn=vcg-tech,ou=Group,dc=vcg,dc=com"
AUTH_LDAP_USER_FLAGS_BY_GROUP = { "is_active": "cn=vcg-tech,ou=Group,dc=vcg,dc=com", "is_staff": "cn=virgo-admin,ou=Group,dc=vcg,dc=com", "is_superuser": "cn=virgo-admin,ou=Group,dc=vcg,dc=com", }
AUTH_LDAP_MIRROR_GROUPS = True
AUTH_LDAP_ALWAYS_UPDATE_USER = True AUTH_LDAP_FIND_GROUP_PERMS = True
AUTH_LDAP_CACHE_TIMEOUT = 3600
import logging
logger = logging.getLogger('django_auth_ldap') logger.addHandler(logging.StreamHandler()) logger.setLevel(logging.DEBUG)
|