J
JohnnyO''''Clock
I've been trying to build an LDAP provider in ASP.Net 2.0. I know the basic
steps are to search the directory for user object, grab the full user object
context and bind to it securely, and then attempt to authenticate by sending
the username and password. I can't find any documentation on using LDAPS for
authenticating to a non-microsoft ldap server. Here's a console code snippet
I've been using which works and enumerates a user's properties:
using System;
using System.Collections.Generic;
using System.Text;
using System.DirectoryServices;
namespace iPlanet
{
class Program
{
static void Main(string[] args)
{
string adsPath = "LDAP://ldap.school.edu/dc=school,dc=edu";
//Explicitly create our SearchRoot
DirectoryEntry searchRoot = new DirectoryEntry(
adsPath,
null,
null,
AuthenticationTypes.None
);
//AuthenticationTypes.None - works
//AuthenticationTypes.Anonymous - doesn't work
//AuthenticationTypes.Secure - doesn't work
//AuthenticationTypes.SecureSocketsLayer - doesn't work
//AuthenticationTypes.Encryption - doesn't work
//AuthenticationTypes.ReadonlyServer - works
//AuthenticationTypes.ServerBind - works
//AuthenticationTypes.Signing - works
//AuthenticationTypes.Sealing - works
//AuthenticationTypes.FastBind - works
//AuthenticationTypes.Delegation - works
using (searchRoot)
{
DirectorySearcher ds = new DirectorySearcher(
searchRoot,
"(uid=jdoe)" //user being searched for
);
using (SearchResultCollection src = ds.FindAll())
{
//Console.WriteLine("Returning {0}", src.Count);
foreach (SearchResult sr in src)
{
foreach (string prop in sr.Properties.PropertyNames)
{
foreach (object o in sr.Properties[prop])
{
Console.WriteLine("{0}: {1}", prop, o);
}
}
}
}
}
}
}
}
The problem I have is when I've tried to bind to the LDAP server. It errors
out with the message that the server may not be operational. What the correct
authentication type for an iPlanet ldao server?
steps are to search the directory for user object, grab the full user object
context and bind to it securely, and then attempt to authenticate by sending
the username and password. I can't find any documentation on using LDAPS for
authenticating to a non-microsoft ldap server. Here's a console code snippet
I've been using which works and enumerates a user's properties:
using System;
using System.Collections.Generic;
using System.Text;
using System.DirectoryServices;
namespace iPlanet
{
class Program
{
static void Main(string[] args)
{
string adsPath = "LDAP://ldap.school.edu/dc=school,dc=edu";
//Explicitly create our SearchRoot
DirectoryEntry searchRoot = new DirectoryEntry(
adsPath,
null,
null,
AuthenticationTypes.None
);
//AuthenticationTypes.None - works
//AuthenticationTypes.Anonymous - doesn't work
//AuthenticationTypes.Secure - doesn't work
//AuthenticationTypes.SecureSocketsLayer - doesn't work
//AuthenticationTypes.Encryption - doesn't work
//AuthenticationTypes.ReadonlyServer - works
//AuthenticationTypes.ServerBind - works
//AuthenticationTypes.Signing - works
//AuthenticationTypes.Sealing - works
//AuthenticationTypes.FastBind - works
//AuthenticationTypes.Delegation - works
using (searchRoot)
{
DirectorySearcher ds = new DirectorySearcher(
searchRoot,
"(uid=jdoe)" //user being searched for
);
using (SearchResultCollection src = ds.FindAll())
{
//Console.WriteLine("Returning {0}", src.Count);
foreach (SearchResult sr in src)
{
foreach (string prop in sr.Properties.PropertyNames)
{
foreach (object o in sr.Properties[prop])
{
Console.WriteLine("{0}: {1}", prop, o);
}
}
}
}
}
}
}
}
The problem I have is when I've tried to bind to the LDAP server. It errors
out with the message that the server may not be operational. What the correct
authentication type for an iPlanet ldao server?