Solved

Using C# to authenticate user against openLDAP

Posted on 2013-01-08
5
1,747 Views
Last Modified: 2013-01-14
We are able to connect to openLDAP using c# but some how not able to authenticate users from OpenLDAP, here is our code., any help is appreciated.

public override bool ValidateUser(string username, string password)
        {
           
            bool isValid = false;

            try
            {
                DirectoryEntry dirEntry = new DirectoryEntry(ConfigurationManager.ConnectionStrings["LDAPConnection"].ConnectionString, "cn=manager,dc=domain,dc=in", "Password", AuthenticationTypes.FastBind);

                DirectorySearcher dsSearch = new DirectorySearcher(dirEntry);
                dsSearch.Filter = "(&(objectClass=mailuser)(mail=" + username + "))";
                SearchResult srResult = dsSearch.FindOne();
                if (srResult != null)
                {

                      isValid = true;
                   
                }

            }
            catch (Exception)
            {
            }


            return isValid;
        }
0
Comment
Question by:Pinemail11
  • 4
5 Comments
 
LVL 14

Expert Comment

by:KoenVosters
ID: 38755071
Since you are using SharePoint, I suppose you are using LDAP already as an authentication. Why would you want to authenticate the user again?

http://www.sharepointboost.com/blog/how-to-configure-claims-based-authentication-for-use-with-an-ldap-provider-in-sharepoint-2010/
0
 

Author Comment

by:Pinemail11
ID: 38755665
Thanks, we are using SP foundation, just want to check, solution proposed by you, will it work with SP foundation.

Thanks
0
 

Author Comment

by:Pinemail11
ID: 38757712
As you know that the default LDAP role provider and membership will work only for Active Directory. SharePoint Foundation doesn't have any other role provider to connect with Open LDAP. We have already tested the scenario.

For connecting a web application to Open LDAP, we have created a custom role provider. LDAP is connecting to the webapplication, we could able to add users through people picker. But they cannot able to login in to the site collection. we believe that users password is not able to resolve while login. The SSHA password encryption is used by Open LDAP. Do SharePoint FBA supports SSHA password format?
0
 

Accepted Solution

by:
Pinemail11 earned 0 total points
ID: 38758952
Quick reply will be appreciated
0
 

Author Closing Comment

by:Pinemail11
ID: 38773865
We want to close down the service, hence closing the question.

Overall not happy with the responses from expert-exchange. please note this feedback is not specific to this question, it is general observation.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

SharePoint Designer 2010 has tools and commands to do everything that can be done with web parts in the browser, and then some – except uploading a web part straight into a page that is edited in SPD. So, can it be done? Scenario For a recent pr…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video discusses moving either the default database or any database to a new volume.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now