【发布时间】:2011-07-28 14:47:21
【问题描述】:
我想将 ActiveDirectory 数据库的用户导入 Django。为此,我正在尝试使用 django_auth_ldap 模块。
这是我已经尝试过的:
在我的 settings.py 中:
AUTH_LDAP_SERVER_URI = "ldap://example.fr"
AUTH_LDAP_BIND_DN = 'cn=a_user,dc=example,dc=fr'
AUTH_LDAP_BIND_PASSWORD=''
AUTH_LDAP_USER_SEARCH = LDAPSearch('ou=users,dc=example,dc=fr', ldap.SCOPE_SUBTREE, '(uid=%(user)s)')
AUTH_LDAP_GROUP_SEARCH = LDAPSearch('ou=groups,dc=example,dc=fr', ldap.SCOPE_SUBTREE, '(objectClass=groupOfNames)')
AUTH_LDAP_GROUP_TYPE = ActiveDirectoryGroupType()
#Populate the Django user from the LDAP directory
AUTH_LDAP_USER_ATTR_MAP = {
'first_name': 'sAMAccountName',
'last_name': 'displayName',
'email': 'mail'
}
AUTHENTICATION_BACKENDS = (
'django_auth_ldap.backend.LDAPBackend',
'django.contrib.auth.backends.ModelBackend',
)
然后我打电话给python manage.py syncdb 没有结果。没有警告,没有错误,auth_user 表中没有任何更新。有什么明显的我忘了做吗?
【问题讨论】:
标签: django active-directory ldap django-auth-ldap