How to Create LDAP Schema with Eclipse
March 27, 2014LDAP schema can be created easily using eclipse and then it can be imported in LDIF file. To start with LDAP schema, we must ensure that LDAP server must be running. In LDAP server data is saved in hierarchical tree structure. We will take one example of data and will create the schema using eclipse. After creation we will import this data and save it into LDIF file. The dependency is that LDAP server must be installed in eclipse and should be running. Find the link.
Create Local LDAP Server in Eclipse with Apache Directory Studio To create LDAP schema, we must be familiar with some keyword which is used in LDAP schema. Find those keywords which will frequently be used in creating LDAP schema.
o : Organization
ou : Organizational unit
cn : Common Name
sn : Surname
uid : User Id
dn : Distinguished name
Now to create schema we will create a scenario. We have a cp as organization. It has two role admin and reader and two users. We will associate one user with admin role and one user with reader role. Find the tree structure of data.
cp |__roles __admin | |__ reader |__users__Mahesh Sharma |__ Nikhil SinghNow we will go step by step to create schema.
1. Create the PartitionTo create the partition, double click on the LDAP server and then click on partitions tab at the bottom. Click on add button. Enter data in ID text as cp and change suffix as o=cp as below.
2. Create the RolesNow we need to create the roles. To create role, right click on o=cp in LDAP browser. Select create entry from scratch and click on next. From Available object classes column, select organizationalUnit and click on add. Now it will be available in Selected object classes column as below.
3. Add UsersNow we will add users. We have two user, we will create user id and password for both user and will associate one user with admin role and second user with reader role. First we will create for admin. Right click on ou=admin in LDAP browser. Click on New->New Entry and select "create entry from scratch" and go to next and find inetOrgPerson from "Available object classes" column. Click on add and then it will be available in "Selected Object classes" column as below.
Export LDIF file of Created SchemaTo get the LDIF file of the created schema, right click on "o=cp", and click on export ->LDIF Export and then click next and browse the location and enter file name as cp.ldif as below
dn: cn=Mahesh Sharma,ou=admin,o=cp objectClass: top objectClass: inetOrgPerson objectClass: person objectClass: organizationalPerson cn: Mahesh Sharma sn: Sharma uid: umahesh userPassword:: e1NTSEF9S3JrRXZCOG1iMFBIaC8zRktCeGs5WjRjNmhPRXU2K2UrYXBHZ2c9P dn: cn=Nikhil Singh,ou=reader,o=cp objectClass: top objectClass: inetOrgPerson objectClass: person objectClass: organizationalPerson cn: Nikhil Singh sn: Singh uid: unikhil userPassword:: e1NTSEF9V05JUEhxbFM1NHU1bDNDa0gyRHlCYTBOWmViYWgzclVETWZremc9P dn: o=cp objectclass: extensibleObject objectclass: top objectclass: domain dc: cp o: cp dn: ou=reader,o=cp objectClass: top objectClass: organizationalUnit ou: reader dn: ou=admin,o=cp objectClass: top objectClass: organizationalUnit ou: admin