[英]LDAP, DirectoryServices c# search base for queries
我正在嘗試使用具有客戶端登錄名(顯然必須是簡單綁定)(具有專有名稱)的LDAP服務器。
var clientEntry = new DirectoryEntry(
"LDAP://server.de",
"cn=medialibrary, ou=special users, dc=uni, dc=de",
"password",
AuthenticationTypes.None);
DirectorySearcher directorySearch = new DirectorySearcher(clientEntry, "(cn=searchuser");
SearchResult result = directorySearch.FindOne();
通過DN的連接工作正常。 但是,搜索cn = searchuser不會返回任何用戶(也沒有錯誤)。
我們嘗試搜索的用戶位於以下路徑:
OU =人,DC =單,DC = DE
在LDAP-Admin實用程序中,我們可以使用cn = medialibrary etc DN登錄,然后如果將搜索基礎修改為“ ou = people,dc = uni-potsdam,dc = de”,然后進行搜索,則會找到cn = searchuser條目
問題是,用C#代碼在該實用程序中修改搜索庫的等效性是什么?
(目標用戶與我最初必須綁定到的目錄條目所給定的默認分支位於不同的分支中。)
我相信這個原始的目錄url已經嘗試過並且沒有用(權限?)
LDAP://server.de/ou=people,dc=uni,dc=de
string LDAPpAth = "dc=uni,dc=de"
string filter = "(cn=searchuser)"
string username = "medialibrary"
string password = "password"
DirectoryEntry startingPoint = new DirectoryEntry("LDAP://"+LDAPpAth, username, password);
DirectorySearcher searcher = new DirectorySearcher(startingPoint);
searcher.Filter = filter;
從那里,您可以執行searcher.findone並使用所需的值。 讓我知道是否可行。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.