cezarlamann
cezarlamann

Reputation: 1523

Is there a library to provide LDAP-like object structure for C#?

I want to develop a generic Authentication/Authorization library based on Users, Departments, where each department has claims and users could have roles and so on. After so much thinking and searching on web, I think that the most adequate way to go (based on my scenarios) is to develop a LDAP-like structure. This way I could even develop an integration with Active Directory/OpenLDAP after.

LDAP Structure Picture taken from here

Before making my own library, i would know: is there a library that already provides objects aiming this structure (this way I could inherit and customize)? I know that we have System.DirectoryServices from .NET Framework and the corresponding library from Mono, but I could not find where the "Entry" classes are. I know that there is a Novell-made library aiming LDAP too, but I think that there is a lot of outdated on the internet about this one.

EDIT

I've found DirectoryEntry class that comes close, but I could not verify if it is Mono compliant.

Upvotes: 0

Views: 794

Answers (1)

X3074861X
X3074861X

Reputation: 3819

As you've likely discovered, there are many, many different implementations of the LDAP protocol across a multitude of providers, so finding a one-size-fits-all library is going to be nearly impossible.

However, you're correct is assuming that many of the same concepts (groups, domains, individual entries, etc.) will apply regardless of which provider you're working with, and even the process of connecting to a given directory server, applying a filter based on LDAP syntax, then processing the results that are returned, is extremely common.

Thus, even though said library doesn't exist, you can certainly build an interface around those general concepts from which all of your specific implementations would inherit from.

From a more technical standpoint, you'd be surprised how portable DirectoryEntry is - I use it along with some basic constructs from System.DirectoryServices.Protocols to connect and bind to Active Directory, iPlanet, and OpenDJ, and it works wonderfully.

You also mentioned Novell - for that, I used their .Net library Novell.Directory.Ldap, which you can find here. You'll notice the concept of an "entry" is available here as well, encompassed within the LdapEntry class.

Upvotes: 2

Related Questions