ADAM で作成したユーザーを使用して、ADAM に対してユーザーを認証しようとしています。ただし、使用されたパスワード (正しいか間違っているか) に関係なく、私の検索では有効な DirectoryEntry オブジェクトが返されます。パスワードが無効な場合、検索で null オブジェクトが返されると思います。私の仮定は間違っていますか、それとも以下のコードに欠陥がありますか?
DirectoryEntry de = new DirectoryEntry("LDAP://localhost:389/cn=Groups,cn=XXX,cn=YYY,dc=ZZZ");
DirectorySearcher deSearch = new DirectorySearcher();
deSearch.SearchRoot = de;
deSearch.Filter = "(&(objectClass=user) (cn=" + userId + "))";
SearchResultCollection results = deSearch.FindAll();
if (results.Count > 0)
{
DirectoryEntry d = new DirectoryEntry(results[0].Path, userId, password);
if (d != null)
DoSomething();
}