I have requirement to authenticate my web application using LDAP Authentication against Lotus Notes(Not Active Directory).
Besides get list of user from LDAP. I am able to get list of users from LDAP using following class
LdapConnection
SearchRequest
SearchResponse
SearchResultEntryCollection
But I don't know how to authenticate user with LDAP Password. I am able to validate only user id.
whether password can be taken?
How to find what encryption they have used.
Kindly guide me on the same.
many suggest following code, but it is not validating the users' password rather it does only user alone. Password given in the code is used for binding with LDAP Directory.
//Update the new path to the user in the directory.
_path = result.Path;
_filterAttribute = (string)result.Properties["cn"][0];
}
catch (Exception ex)
{
throw new Exception("Error authenticating user. " + ex.Message);
}
thanjaipvr
Member
10 Points
7 Posts
How to Authenticate Lotus LDAP Directory in asp.net web Application
Dec 04, 2012 01:18 PM|LINK
Dear All,
I have requirement to authenticate my web application using LDAP Authentication against Lotus Notes(Not Active Directory).
Besides get list of user from LDAP. I am able to get list of users from LDAP using following class
LdapConnection
SearchRequest
SearchResponse
SearchResultEntryCollection
But I don't know how to authenticate user with LDAP Password. I am able to validate only user id.
whether password can be taken?
How to find what encryption they have used.
Kindly guide me on the same.
many suggest following code, but it is not validating the users' password rather it does only user alone. Password given in the code is used for binding with LDAP Directory.
public bool IsAuthenticated(string domain, string username, string pwd)
{
string domainAndUsername = domain + @"\" + username;
DirectoryEntry entry = new DirectoryEntry(_path, domainAndUsername, pwd);
try
{
//Bind to the native AdsObject to force authentication.
object obj = entry.NativeObject;
DirectorySearcher search = new DirectorySearcher(entry);
search.Filter = "(SAMAccountName=" + username + ")";
search.PropertiesToLoad.Add("cn");
SearchResult result = search.FindOne();
if(null == result)
{
return false;
}
//Update the new path to the user in the directory.
_path = result.Path;
_filterAttribute = (string)result.Properties["cn"][0];
}
catch (Exception ex)
{
throw new Exception("Error authenticating user. " + ex.Message);
}
return true;
}
With Regards
Palanivelrajan
Angie xu - M...
All-Star
18665 Points
1590 Posts
Microsoft
Re: How to Authenticate Lotus LDAP Directory in asp.net web Application
Dec 13, 2012 08:03 AM|LINK
Hi thanjaipvr
Please refer the link below, and check whether helpful to LDAP password authenticate,
Using LDAP for Password Authentication- http://msdn.microsoft.com/en-us/library/aa367028(v=VS.85).aspx
hope it helpful to you.
Kind regards
Feedback to us
Develop and promote your apps in Windows Store