Solved

Using C# to authenticate user against openLDAP

Posted on 2013-01-08
5
1,800 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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The vision: A MegaMenu for a SharePoint portal home page The mission: Make it easy to maintain. Allow rich content and sub headers as well as standard links. Factor in frequent changes without involving developers or a lengthy Dev/Test/Prod rel…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

839 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