(888) 685-3101 ext. 2

Mule 4 LDAP Operations:

  1. Search
  2. Create OU(organizationalUnit)
  3. Create a user
  4. Modify
  5. Delete

Pre-requisites:

  1. Anypoint studio 7
  2. Java 8
  3. OpenLDAP, OUD, OID, Mircrosoft AD.

Acronyms:

mule ldap acronyms

1. Search operation

Step1: Create a project in anypoint studio and drag and drop all the required components from mule component palette as shown in below flow.

ldap sample flow

Step2: Installed Oracle unified directory LDAP server, as mentioned in the below screenshot. Next, traverse the tree structure of LDAP server.

unified directory ldap server

Step3: In the search component we must configure LDAP server details.
Password is

ldap configuration

Step4: After configured LDAP server details we must provide the Distinguished Name (DN) and filter (should be Common Name(CN)) these are the main fields to search in the LDAP server.

OUDSearch DN filter

Step5: Once run the application it must be deployed status.

deployed status

Step6: To test the result open postman hit the send button, see the result as below. Common name ramesh has taken as filter so that result given as below. localhost:8089/oud

postman hit send

2. Create OU(organizationalUnit)

Step1: Create a project in anypoint studio. Drag and drop all the required components from mule component palette as mentioned in below flow.

ldap ou creation flow

Step2: In add entry component we need to select the structural class as organizationalUnit because I am creating a group on to the LDAP server to create multiple users on this unit.

organizationalunit

Step3: In DataWeave I am creating a group as DevOpsGroup like organizational Unit(OU). Here I am getting Distinguished Name(dn) from queryparams.

Top Class: is the superclass of all the classes in every LDAP server’s language. if you want to create any user or OU etc…. we must import top class.

ldapgroup

Step4: Once we hit the API from postman we can see the logs for add entry operation in the console like below for organizational Unit.

logs add entry

Logs:

logs

Step5: I have logged into OUD LDAP server and refreshed it to get the updated entry on to the server. Now I can able to see the LDAPGroup OU creation.

ldapgroup ou

3. Create a user under OU:

Step1: Create a project in anypoint studio. Drag and drop all the required components from mule component palette as mentioned in below flow.

user creation flow

Step2: In add entry component we need to select the structural class as Person because I am creating a user on to the LDAP server.

structural class person

Step3: In DataWeave I am creating a user LdapUser as common name (cn) into DevOpsGroup organizationalUnit(OU). Here I am getting Distinguished Name(dn) from queryparams.

devopsgroup

Step4: Once we hit the API from postman we can see the logs for add entry operation in the console like below.

postman logs

Logs:

logs

Step5: I have logged into OUD LDAP server and refreshed it to get the updated entry on to the server. Now, I am able to see the LdapUser creation.

oud ldap server

4. Modify a User:

Step1: Create a project in anypoint studio. Drag and drop all the required components from mule component palette as below flow.

modifyldapuserflow

Step2: In modify entry component, we need to select the structural class as Person because I am modifying a user’s data on to the LDAP server.

modify entry

Step3: Before modifying user’s data, DataWeave code needs to be written as mentioned below.

dataweavecode

Step4: After modified user’s data DataWeave could be like below. Here I am trying to modify LdapUser’s data.

ldapusersdata

Step5: Once we hit the API from postman, can see the logs for modified entry data in the console like below.

modified data entry

Logs:

logs

Step5: Before modify user’s data in OUD LDAP server

user data

After modified operation, user’s data changed as shown below.

user data

5. Delete operation:

Step1: Create a project in anypoint studio. Drag and drop all the required components from mule component palette as mentioned in below flow.

oucdeleteuserflow

Step2: In delete component we must provide the DN. User will delete based on DN condition like below.

DN

Step3: Once we hit the API from postman we can see the logs for add entry operation in the console like below.

logs
logs

Step4: Before delete a user on LDAP server we can see Test User as mentioned in below screen.

test user

After delete a user on LDAP server.

delete user

Share This