2015-12-11 193 views
2

我想使用现有的Active Directory系统进行用户身份验证,但存在问题。Django LDAP Active Directory

这工作:

ldapsearch -D "[email protected]" -x -w PASSWORD -b "OU=users,OU=otdel,DC=dom,DC=comp,DC=local" -h x.x.x.x 

我应该在哪里输入用户名以连接到AD?

AUTH_LDAP_SERVER_URI = "ldap://ldap.example.com" 
AUTH_LDAP_BIND_DN = ??? 
AUTH_LDAP_BIND_PASSWORD = "PASSWORD" 
AUTH_LDAP_USER_SEARCH = LDAPSearch("ou=users,ou=otdel,dc=dom,dc=comp,dc=local", ldap.SCOPE_SUBTREE, "(cn=%(user)s)") 
+0

你使用Python 2还是Python 3?你使用哪个Python包进行LDAP,哪些用于Django LDAP? – FlipperPA

回答

0

在你ldapsearch字符串,在binddn-D说法。所以,假设[email protected]有效,您应该可以将AUTH_LDAP_BIND_DN设置为相同的值。

1

我现在在Python 3中,唯一能够使用Active Directory的软件包是django-python3-ldap。虽然配置OpenLDAP的默认情况下,它是配置它为Active Directory不在话下,甚至还记载:

https://github.com/etianen/django-python3-ldap

给它一看,和好运气。