Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Using C# to authenticate user against openLDAP

Posted on 2013-01-08
5
Medium Priority
?
1,915 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

We had a requirement to extract data from a SharePoint 2010 Customer List into a CSV file and then place the CSV file into a directory on the network so that the file could be consumed by an AS400 system. I will share in Part 1 how to Extract the Da…
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…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Screencast - Getting to Know the Pipeline
Suggested Courses

886 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