2015-12-11 187 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

給它一看,和好運氣。