我正在維護使用Devise LDAP進行身份驗證的Rails應用程序。我正在從Active Directory遷移到OpenLDAP,我已經使用相同的結構進行了設置。在安裝Ubuntu Client 12.04 64位時,使用apt-get
軟件包slapd
和ldap-utils
安裝了OpenLdap。Rails - 根據OpenLDAP服務器進行身份驗證後確定組成員身份
我可以對OpenLDAP的驗證,但是當我打電話
Devise::LdapAdapter.get_ldap_entry(email)["memberOf"]
我返回一個空數組。在rails控制檯中,我可以看到返回的ldap條目沒有「memberOf
」條目。
當我查詢從我收到下面的輸出終端的LDAP服務器:
ldapsearch -H ldapi:/// -x -b "cn=people,dc=example,dc=local" memberOf
...
# fred fred, people, example.local
dn: cn=fred fred,cn=people,dc=example,dc=local
memberOf: cn=Authorisers,ou=example,dc=example,dc=local
...
是任何人都知道爲什麼ldapsearch
可能會返回不同的結果制定?並沒有任何人知道如何獲得回報memberOf屬性?
在此先感謝
與LDAP認證的寶石(從線束輸出)
Using devise (2.1.2)
Using net-ldap (0.2.2)
Using devise_ldap_authenticatable (0.6.1)
Using activesupport (3.2.9)
Using activemodel (3.2.9)
Using sprockets (2.2.2)
Using mail (2.4.4)
Using activerecord (3.2.9)
Using activeresource (3.2.9)
你從wireshark請求ruby嗎?它是否發佈了另一個? – Reactormonk
謝謝@Tass,當我回來時,我會看看。我應該比較ruby,MS Active Directory,openldap之間的wireshark捕獲以及ldapsearch和MS Active Directory和openldap – Jimmy
Hi @Tass,是的一個區別。遠程「ldapsearch」在「searchRequest」消息中指定「memberOf」AttributeDescription。但是,從Ruby到ActiveDirectory LDAP服務器的請求中缺少這一點,但memberOf詳細信息仍然返回。我想知道是否有辦法將這個屬性附加到Ruby請求上,或者配置openldap來返回它? – Jimmy