我有一段時間讓omniauth-ldap能夠正常使用我們的AD服務器,我相信這是因爲我們的用戶名有我們的域名。Omniauth-ldap無效的憑據
這將成功地連接到我們的LDAP服務器:
ldapsearch -h ldap.ourdomain.com -b "dc=ourdomain,dc=int" -D "OURDOMAIN\username" -w <password> '(sAMAccountName=username)'
但是,在OmniAuth這些設置只會導致 「無效憑證」
Padrino.use OmniAuth::Strategies::LDAP,
:host => "ldap.ourdomain.com",
:base => "dc=OURDOMAIN,dc=INT",
:uid => "sAMAccountName",
:bind_dn => 'OURDOMAIN\%{username}',
# This is hard coded for now, but I need it to be the value entered by the user
:password => "mypassword"
UPDATE
這方面的工作此外,我發現omniauth-ldap會將bind方法設置爲:anonymous,如果:bind_dn和:password未設置。
但是,如果設置的值爲爲,則不會插入用戶名,也不會提供用戶輸入的密碼。
我需要的是
:bind_dn => 'OURDOMAIN\<user entered username>',
:password => <user entered password>
但密碼和輸入的用戶名只提供給連接,如果你硬編碼他們。