我有一段代碼在綁定操作後在活動目錄服務器上執行搜索。我使用LDAP協議綁定和我的代碼如下所示:使用匿名進行活動目錄搜索bind
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.SECURITY_AUTHENTICATION, "none");
env.put("com.sun.jndi.ldap.read.timeout", "9000");
env.put("com.sun.jndi.ldap.connect.timeout", "9000");
env.put(Context.PROVIDER_URL, "ldap://" + "nec.jp");
DirContext ctx = new InitialDirContext(env);
NamingEnumeration<SearchResult> answer = ctx.search(
searchBase, searchFilter, searchCtls);
if (answer.hasMore())
{
env.put(Context.SECURITY_PRINCIPAL, principalNameres);
env.put(Context.SECURITY_CREDENTIALS, userPasswd);
env.put(Context.SECURITY_AUTHENTICATION, "simple");
final DirContext ctxForSerachedResult = new InitialDirContext(
env);
ctxForSerachedResult.close();
}
我在這裏的問題是與匿名登錄的用戶進行搜索AD服務器的配置。
作爲每理解爲遠,匿名可以通過執行以下所示的步驟啓用:
一個。通過更改DsHeuristics屬性值啓用匿名LDAP操作。
b。提供讀取目錄的權限。
簡稱鏈接:
- http://social.technet.microsoft.com/Forums/en/winserverDS/thread/524a77fb-e819-497e-ae8a-c0fc43f1bba8
- http://support.microsoft.com/kb/326690
我曾試圖使用Ldp.exe綁定匿名登錄成功,如圖下圖所示的圖像批准Active Directory中設置:
但是搜索操作仍然不能按需要工作。
請建議我在哪裏出錯。
當執行搜索的輸出來作爲---- ***搜索... ldap_search_s(LD, 「DC = nec,DC = jp」,2,「(samAccountName = dctestuser1)」,attrList,0,&msg) 獲取0個條目: ----------- Active Directory服務器用戶名稱爲「dctestuser1」。 – user1931914