none
LDAP Authentication for Lotus Notes users directory

    Question

  • Dear All,

    I have requirement to authenticate my web application using LDAP Authentication against Lotus Notes(Not Active Directory)

    I found the following code from ASP Forum to get the list of users which is mainly used for Active Directory. I tried the same code against Lotus Notes but it gives "The Server is not in operational" error message.

    I got server name, email and password for lotus notes to bind the server and to get list of user. I also have "CN=cnvalue,O=Orgunitvalue,C=IN" but I don't know where to pass this one. I used this in first parameter and removed.

    DirectoryEntry entry = new DirectoryEntry("LDAP://ltousldap.mydomain.com:389", "username", "password", AuthenticationTypes.None);

    DirectorySearcher search = new DirectorySearcher(entry);
    search.PropertiesToLoad.Add("uid");
    search.Filter = "(&(objectClass=user))";
    //search.SizeLimit = 1000; 
    foreach (SearchResult result in search.FindAll())
    {
    if (result != null)
    {
    DirectoryEntry de = result.GetDirectoryEntry();
    string uid = de.Properties["uid"].Value.ToString();
    uid = uid.Trim();
    uid = uid.ToLower();
    }
    }

    Solutions2

    string userUid = "";

    DirectoryEntry Ldap = new DirectoryEntry(“LDAP://ltousldap.mydomain.com:389/ CN=LDAP Search,O=DRL,C=IN”, "username", "password", AuthenticationTypes.ServerBind);

    DirectorySearcher LdapSearcher = new DirectorySearcher(Ldap, String.Format("(&(objectClass=*)(uid={0}))", userUid));

    LdapSearcher.PropertiesToLoad.Add("cn");

    LdapSearcher.PropertiesToLoad.Add("uid");

    LdapSearcher.PropertiesToLoad.Add("mail");

    LdapSearcher.PropertiesToLoad.Add("employeeNumber");

    LdapSearcher.PropertiesToLoad.Add("facsimileTelephoneNumber");

    LdapSearcher.PropertiesToLoad.Add("foremfunction");

    LdapSearcher.PropertiesToLoad.Add("foremservice");

    LdapSearcher.PropertiesToLoad.Add("foremsite");

    LdapSearcher.PropertiesToLoad.Add("inetUserStatut");

    LdapSearcher.PropertiesToLoad.Add("telephoneNumber");

    LdapSearcher.PropertiesToLoad.Add("uid");

    LdapSearcher.PropertiesToLoad.Add("mail");

    SearchResultCollection LdapSearcherResults = LdapSearcher.FindAll();

    foreach (SearchResult resultLdap in LdapSearcherResults)

    {

    Console.WriteLine(resultLdap.Properties["cn"][0].ToString());

    Console.WriteLine(resultLdap.Properties["uid"][0].ToString());

    Console.WriteLine(resultLdap.Properties["mail"][0].ToString());

    }

    <//span>

    Kindly suggest me to over come and guide me what is required to pass as parameter in DirectoryEntry class.

    Monday, October 29, 2012 2:11 PM