Mule 4 LDAP Operations:
- Search
- Create OU(organizationalUnit)
- Create a user
- Modify
- Delete
Pre-requisites:
- Anypoint studio 7
- Java 8
- OpenLDAP, OUD, OID, Mircrosoft AD.
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.
Step2: Installed Oracle unified directory LDAP server, as mentioned in the below screenshot. Next, traverse the tree structure of LDAP server.
Step3: In the search component we must configure LDAP server details.
Password is
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.
Step5: Once run the application it must be 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
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.
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.
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.
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:
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.
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.
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.
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.
Step4: Once we hit the API from postman we can see the logs for add entry operation in the console like below.
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.
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.
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.
Step3: Before modifying user’s data, DataWeave code needs to be written as mentioned below.
Step4: After modified user’s data DataWeave could be like below. Here I am trying to modify LdapUser’s data.
Step5: Once we hit the API from postman, can see the logs for modified entry data in the console like below.
Logs:
Step5: Before modify user’s data in OUD LDAP server
After modified operation, user’s data changed as shown below.
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.
Step2: In delete component we must provide the DN. User will delete based on DN condition like below.
Step3: Once we hit the API from postman we can see the logs for add entry operation in the console like below.
Step4: Before delete a user on LDAP server we can see Test User as mentioned in below screen.
After delete a user on LDAP server.