Sammuel-Miranda / LdapServerLib

LDAP Server (simplified for e-mail address book) based on Flexinets.Ldap.Server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LdapServerLib

Intended to be a source provider for e-mail softwares to load as address book.

This project is a "fork" of vForteli's "Flexinets.Ldap.Server" and "Flexinets.Ldap.Core" projects combined, and changed to Microsoft .Net Framework 2.0.

Thanks to constant help from it's original developer i'm at the stage where both Microsoft Outlook and Mozilla Thunderbird runs smoothly with it as an Address book provider


Update of 2019-06-11

As of today, the grouping works as intended. It allows for grouping and sub-grouping with any level. Search may be tricky since there's not difference still as for SingleLevel/FullSubTree searches (they are all treated as SingleLevel). Also, it's still returning the root element as a result, so the tree is cascatable for infinity.

Update of 2019-06-10

All it does is add the groups (Departments) as a list of OrganizationalUnits. It also matchs the Search criteria for those groups, allows (supposebly, don't know for sure yet) you to bind to the root or to the Group, and list it's users only. Provides a better response to Unbind/Disconnect and also to the first Bind request (as happens on the LdapAdmin program).

Problems: It provides the Root data as a SearchResultEntry on the first Bind request, and so, it may cause a infinity of cascades if that node is expanded.


How To Use It

I reorganized the project's code in 2 files, the Libs.cs and the Sample.cs.

In the Libs.cs file are the classes that do not require any change whatsoever for implementation. And if the DEBUG markup is set to false in the project, is possible to compile it's contents as a DLL for use in other projects (with that mark set to false, noting on the Sample.cs will be compiled).

Those classes include all code originated from vForteli's project for the core attributes of the LDAP calls, my modified version of the (LDAP) Server class and the base classes for Installing, Starting, Stoping and Uninstalling it (or anything else really) as a Windows Service. One observation on that note: to do so, you must run the application as an Windows Administrator.

In the Sample.cs file, are the IUserData implementation (a simple one), the IGroup implementation and the IDataSource implementation. All theses classes do is store (User and Group - department) information and provide it to the server as called upon. The Service class is the derivation of the ServiceInstaller class (from the Libs.cs file, which is an abstract one).


Adaptation Required

Currently, since it's a sample, the information provided by the IDataSource is fixed, and always return the same. You should change that class (taking that one as an example) to store and retrieve the user and company data from a file directory, database, webservice or any other source of information you use. Ideally, you would also change the other 3 classes on the Sample.cs file to better accomodate your project, but in the way it is now you can just change the TestSource class and keep the rest as is.


Calling the Service once Compiled

Once the project is compiled (using the guidelines above) you may call the commands (as listed on the Libs.cs file Constants of the ServiceInstaller class) to Install, Start, Stop and Uninstall the program as a service.

Just open a Command Line Console (cmd - or Powershell) and call the executable followed by the corresponding argument. Calling the executable without any argument means the same as the "RUN" command. So you would (suposing the application is on "C:\app"):

C:\app\ServiceLDAP.exe "install" -> To install it (as a service)

C:\app\ServiceLDAP.exe "start" -> To start the service (once is installed - it will do this automatically when you install)

C:\app\ServiceLDAP.exe "stop" -> To stop the running service (once installed and started)

C:\app\ServiceLDAP.exe "uninstall" -> To uninstall it from the service list on Windows


Using it on an e-mail managing client

Taking Mozilla's Thunderbird as an example, this should be the resulting configuration and responses of a search (using "*" as argument) to list all contacts on the LDAPRoot provided:

Example

And also, the configuration used to connect to Microsoft's Outlook:

Example

For testing purposes, i also configured a different client (not an E-mail one), using the LdapAdmin (from LdapAdmin.org). This one also connects and using the search tools it shows the list of users. However, i verified (connecting to a different server) that it does not behave the same. Connecting to another server, it lists all objects when connected, without the need to search. Still serves the original purpuse of this project, but i'd like to improve it to behave as it should.

Example

About

LDAP Server (simplified for e-mail address book) based on Flexinets.Ldap.Server

License:MIT License


Languages

Language:C# 100.0%