Search User In LDAP Using Mule LDAP Conenctor
In this tutorial we will demonstarte how can we Search User In LDAP Using Mule LDAP Conenctor
Prerequisite:
To use the LDAP Connector, you must have the following:
- Access to either an OpenLDAP, Apache Directory, or MicroSoft Active Directory Instance.
- Anypoint Studio version 7.0 (or higher) or Anypoint Design Center.
To use the LDAP Connector in a production environment, you must have either:
- An Enterprise license to use Mule.
- A CloudHub Starter, Professional, or Enterprise account.
Below LDAP operations are present to perform LDAP search
Search one: Performs a LDAP search that is supposed to return a unique result. If the search returns more than one result, then a warn log message is generated and the first element of the result is returned.
Use this operation when you don’t know the DN of the entry you need to retrieve but you have a set of attributes that you know should return a single entry (for example an email address)
Search: Performs a LDAP search returning a list with all the resulting LDAP entries.
Lookup: Retrieves an entry from the LDAP server base on its distinguished name (DN). DNs are the unique identifiers of an LDAP entry, so this method will perform a search based on this ID and so return a single entry as result or throw an exception if the DN is invalid or inexistent.
Use this operation when you know the DN of the object you want to retrieve.
Paged result search: Performs a LDAP search and streams result to the rest of the flow. This means that instead of returning a list with all results it partitions the LDAP search result into pages (individual entry if resultPageSize is 1) or lists of size resultPageSize.
For queries returning large results it is recommended to use pagination (not all LDAP servers support this or are configured to support it). For that you need to provide a fetch size (page size) value that should be less or equal than max results (count limit).
In this tutorial we will demonstration how to use Search one,Search and lookup operation to perform LDAP search one by one.
First setup some data in LDAP Server, we have set up some users under OU=Users
Search one Operation
Create sample project in anypoint studio
Drag and drop LDAP Search operation from mule palette if you can not find LDAP operation in mule palette please add LDAP module using Exchange visit this url for more information
Provide the Connection Details as given below:
Principal DN: The DN (distinguished name) of the user
Password: The password of the user
URL: The connection URL to the LDAP server
Provide the details as Base DN and Filter to perform Search in LDAP
Transform the payload received from LDAP to Json
Deploy the project and trigger the request from SOAP UI
Search Operation
Drag and drop search operation from mule palette, use the connection created above
Configure the Base DN and Filter, here we want to retrieve the list hence we have given cn=J* parameters, we will get all the users whose name start with J
Transform the payload received from LDAP to Json
Deploy the project and test from SOAP UI
Lookup Operation
Drag and drop lookup operation from mule palette, use the connection created above
Configure the Complete DN Value
Transform the payload received from LDAP to Json
Deploy the project and test from soapui
Sample application: createuserinldap sample application
Soapui project: LdapSearch-soapui-project sample