バインド操作後に Active Directory サーバーで検索を実行するコードがあります。バインディングに LDAP プロトコルを使用しており、コードは次のようになります。
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 設定を承認しようとしましたが、成功しました。
しかし、検索操作はまだ期待どおりに機能していません。
どこが間違っているのか教えてください。