Solved

Using C# to authenticate user against openLDAP

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Initialize SharePoint Online List Values in Quick Edit 7 20
Filename to be appended with DateTimeof Download 3 40
Run time Error 4 34
SQL Exceptions 3 35
Note:  There are two main ways to deploy InfoPath forms:  Server-side and directly through the SharePoint site.  Deploying a server-side InfoPath form means the form is approved by the Administrator, thus allowing greater functionality in the form. …
Summary In SharePoint 2010 it is easy to create custom color themes to jazz up a site. Theme colors can also be created in PowerPoint 2010 with a few clicks. But how do the chosen colors actually look in the SharePoint site? The attached PowerPoint…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

930 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

16 Experts available now in Live!

Get 1:1 Help Now