簡體   English   中英

GlassFish安全領域,Active Directory和引薦

[英]GlassFish Security Realm, Active Directory and Referral

我已經在Glassfish中設置了一個安全領域,以針對Active Directory服務器進行身份驗證。 領域的配置如下:

Class Name: com.sun.enterprise.security.auth.realm.ldap.LDAPRealm
JAAS context:  ldapRealm
Directory: ldap://172.16.76.10:389/
Base DN:  dc=smallbusiness,dc=local
search-filter: (&(objectClass=user)(sAMAccountName=%s))
group-search-filter: (&(objectClass=group)(member=%d))
search-bind-dn: cN=Administrator,CN=Users,dc=smallbusiness,dc=local
search-bind-password: abcd1234!

該領域正常運行,我可以登錄,但是每次登錄時,都會在日志中收到以下錯誤:

SEC1106: Error during LDAP search with filter [(&(objectClass=group)(member=CN=Administrator,CN=Users,dc=smallbusiness,dc=local))].
SEC1000: Caught exception.
    javax.naming.PartialResultException: Unprocessed Continuation Reference(s); remaining name 'dc=smallbusiness,dc=local'
        at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2820)
        ....
        ....
ldaplm.searcherror

在尋找解決方案時,我發現建議將java.naming.referral=follow添加到領域的屬性中。 但是,添加完此文件后,GlassFish需要20分鍾才能對Active Directory進行身份驗證。 我懷疑這是Active Directory服務器上的DNS問題。 Active Directory服務器是虛擬機中的普通Windows Server 2003安裝程序。

任何幫助/建議都將受到高度贊賞!

這是我在domain.xml文件中使用的配置,可能對您來說有些麻煩:

<auth-realm classname="com.sun.enterprise.security.auth.realm.ldap.LDAPRealm" name="ldapRealm"> 
      <property name="search-bind-password" value="Demodemo01"/> 
      <property name="search-bind-dn" value="Administrator"/> 
      <property name="search-filter" value="(&amp;(objectClass=user)(sAMAccountName=%s)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))"/> 
      <property name="group-search-filter" value="(&amp;(objectClass=group)(member=%d))"/> 
      <property name="jaas-context" value="ldapRealm"/> 
      <property name="base-dn" value="CN=Users,DC=saierp,DC=net"/> 
      <property name="directory" value="ldap://192.168.1.38:389"/> 
</auth-realm>

特別是,請確保將userAccountControl添加到過濾器中,否則,將允許連接AD中禁用的帳戶。

希望您已解決此問題,但以防萬一:

  1. 在閱讀前者對索引進行索引時,我使用了“ objectCategory”代替了“ objectClass”,因此速度更快。

  2. 我必須添加此屬性:

    屬性名稱=“ assign-groups” value =“域用戶”

其中“域用戶”是我們所有用戶所在的AD中的組。 這必須與sun-web.xml中用於security-role-mapping的值匹配。

后來,我能夠為此應用程序創建一個特定的組並進行適當的更改。

嘗試解決此問題真是令人發狂... Glassfish 3.0.1嘗試與Windows連接,並收到上述錯誤。

我根本不是Windows或LDAP專家……但最終發現了這一點:

http://forum.springsource.org/showthread.php?t=87673

最后一行是關鍵:使用“全局編錄端口”-而不是389,默認情況下為3268。 異常消失了。

為什么?

誰在乎?

(好吧,我現在要閱讀它。)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM