Home Contact Download
LSC logo
Open source connector to synchronize identities to a LDAP directory from any data source including any database with a JDBC connector, another LDAP server or flat files ...
Download  |  Read more...  |  Get started!

Synchronize from CSV to LDAP directory

This tutorial shows you how to synchronize a CSV file to a LDAP directory. The idea is to use Database to directory (db2ldap) synchronization type on an HSQLDB instance. This HSQLDB instance will be previously populated with data contain in the CSV file.

Build your connector

Configure and build the LSC-sample connector. This tutorial describes quiet well how to do that. But there are some differences :

  • Use the Database to directory task type;
  • Specify “org.hsqldb.jdbcDriver” as JDBC driver;
  • Use “jdbc:hsqldb:hsql://localhost/lscdb” as database connection URI, “sa” as username and ”” (empty) for the corresponding password;

Then, configure the LDAP destination directory as usual. If you would like to use an auxiliary LDAP object class for synchronization, we recommand you to specify a structural object class that is as close as possible (in terms of schema definition) to the desired auxiliary class. Then, see this documentation to create all required Java classes (TODO).

Finaly, build the connector to obtain the desired JAR file.

Manually configure LSC

Specify SQL mapping

LSC will be launch to synchronize data between an HSQLDB instance and an LDAP directory. So, you have to configure the SQL mapping to retrieve correct data from the database table.

The database table should be named “csvdata”, and will contain all field defined in the CSV file to be synchronized. See this documentation to create XML file to map SQL database.

For example, if you have a CSV file like the following:

uid;sn;givenName;cn;mail
jdoe;Doe;John;John Doe;jdoe@example.com

Then, HSQLDB will return something like that with a select query:

UID   SN   GIVENNAME  CN        MAIL
----  ---  ---------  --------  --------------
jdoe  Doe  John       John Doe  jdoe@brinks.fr

Complete lsc.properties

If your synchronization is based on the inetOrgPerson LDAP object class, the configuration file should contain something like the following:

[...]
lsc.tasks.application.type = db2ldap
lsc.tasks.application.srcService = \
  org.lsc.service.InetOrgPersonJDBCService
lsc.tasks.application.object = org.lsc.objects.inetOrgPerson
lsc.tasks.application.bean = org.lsc.beans.inetOrgPersonBean
[...]

If synchronization is based on the UID database field, then you must define it in the lsc.tasks.application.dstService.pivotAttrs property.