Firstly, I cannot use Active Directory , so I cannot use System.DirectoryServices
directly. This will be the computer sending the request to the Novell network, where it is supported only System.DirectoryServices.Protocol
.
I am sure that I need to provide the correct SearchRequest.
This is what I still have:
private static String _certificatePath;
private static String _server;
private static SearchResponse Query(String user, String pwd, out String error)
{
SearchResponse result = null;
error = String.Empty;
if (File.Exists(_certificatePath))
{
var identifier = new LdapDirectoryIdentifier(_server, false, false);
try
{
using (var connection = new LdapConnection(identifier))
{
connection.SessionOptions.ProtocolVersion = 3;
var cert = new X509Certificate();
cert.Import(_certificatePath, null, X509KeyStorageFlags.DefaultKeySet);
connection.ClientCertificates.Add(cert);
connection.AuthType = AuthType.External;
connection.AutoBind = false;
var request = new SearchRequest()
{
DistinguishedName = user,
Filter = "(objectClass=*)",
Scope = System.DirectoryServices.Protocols.SearchScope.Subtree,
};
result = (SearchResponse)connection.SendRequest(request);
}
} catch (Exception err)
{
error = String.Format("SDSP::Query {0}: {1}", err.GetType(), err.Message);
}
}
else
{
error = "The system cannot find the Cryptography Certificate at the path specified in the Application Configuration file.";
}
return result;
}
How to create SearchRequest to check user
/ combination pwd
?
var request = new SearchRequest()
{
DistinguishedName = user,
Filter = "(objectClass=*)",
Scope = System.DirectoryServices.Protocols.SearchScope.Subtree,
};
source
share