Pinemail11
asked on
Using C# to authenticate user against openLDAP
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(Configurati onManager. Connection Strings["L DAPConnect ion"].Conn ectionStri ng, "cn=manager,dc=domain,dc=i n", "Password", AuthenticationTypes.FastBi nd);
DirectorySearcher dsSearch = new DirectorySearcher(dirEntry );
dsSearch.Filter = "(&(objectClass=mailuser)( mail=" + username + "))";
SearchResult srResult = dsSearch.FindOne();
if (srResult != null)
{
isValid = true;
}
}
catch (Exception)
{
}
return isValid;
}
public override bool ValidateUser(string username, string password)
{
bool isValid = false;
try
{
DirectoryEntry dirEntry = new DirectoryEntry(Configurati
DirectorySearcher dsSearch = new DirectorySearcher(dirEntry
dsSearch.Filter = "(&(objectClass=mailuser)(
SearchResult srResult = dsSearch.FindOne();
if (srResult != null)
{
isValid = true;
}
}
catch (Exception)
{
}
return isValid;
}
ASKER
Thanks, we are using SP foundation, just want to check, solution proposed by you, will it work with SP foundation.
Thanks
Thanks
ASKER
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?
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?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.
Overall not happy with the responses from expert-exchange. please note this feedback is not specific to this question, it is general observation.
http://www.sharepointboost.com/blog/how-to-configure-claims-based-authentication-for-use-with-an-ldap-provider-in-sharepoint-2010/