LDAP makes operations on a LDAP server.

Take a look at the configuration parameters of the component:

  • Account: account to be used by the component.

  • Operation: commands available (Add, Delete or Modify).

  • Search Operation: Object, One level or Sub trees.

  • Host Name: name or IP of LDAP.

  • Port: port of LDAP.

  • Authentication DN: Distinguished Name (DN) used to connect the LDAP server.

  • Filter: filter expressions.

  • SSL: security protocol.

  • Fail On Error: if the option is enabled, the execution of the pipeline with error will be interrupted; otherwise, the pipeline execution proceeds, but the result will show a false value for the “success” property.

IMPORTANT: the Authentication DN parameter must be configured with the full path to the aimed user. With that, if Distinguished Name is equal to "CN=UserExample,OU=FOLDER1,DC=abc,DC=com,DC=br", the Authentication DN parameter will be configured with "OU=FOLDER1,DC=abc,DC=com,DC=br". The "CN=UserExample" configuration must be used in the username of the account configured in the component, which means that the username receives the "UserExample" value.

LDAP in Action

You can:

- use a fixed value:

(dnOperation = "ou=system,cn=users")

- get some JSON of the message, that will search the "data" object of the message:

(dnOperation = "{{ message.$.dn }}

- combine both examples:

(dnOperation = " ou={{ message.$.dn }}")

  • searchOperation: integrates between 0 and 2 used to search, as:

0 -> Base Object

1 -> One Level

2 -> Full Subtree

  • modifyOperation: integrates between 0 and 3 used to modify, as:

0 -> Add attribute

1 -> Exclude attribute

2 -> Substitute attribute

3 -> Increment attribute

  • filter: filters configurations for the same search operation.

Example: filter "(objectClass=)"

You can:

- use a fixed value:

filter = ("objectClass=)"

- get some JSON of the message, that will search the 'data' object:

filter = "{{ message.$.filter }}

- combine both examples:

filter = "objectClass={{ message.$.filter }}"

  • entries: the object used to add or modify the entries in LDAP server.

You can:

- used a fixed value:

filter = ("objectClass":["top","person"],"cn":"test_ad","sn":"test_sn"}

- get some JSON of the message, that will search the 'data' object of the message:

entries = "{{ message.$.entries }}

- combine both examples:

entries = {"objectClass":["top","person"],"cn":"{{ message.$.entries }}","sn":"test_sn"}"

  • operation: the operation you want to execute in LDAP server: SEARCH / ADD / MODIFY / DELETE

  • useSsl: if true, it will be connected using SSL (safe connection); otherwise, it won't be connected

  • failOnError: if true, an error will suspend the execution of the pipeline

LDAP needs authentication. For that, you must create an account with administrator privileges (BASIC type) and use it in the component.

IMPORTANT: the username to be used in the account must be the field "name" configured in the LDAP server.

To convert Double Braces, we use JSON Path specifications. Click here to know more.

Messages flow

Operation SEARCH

Input

{
"type": "connector",
"name": "ldap-connector",
"accountLabel": "ldap",
"stepName": "ldap",
"params": {
"operation": "SEARCH",
"host": "LDAP_IP",
"port": 389,
"dnAuthentication": "DC=digibee,DC=io",
"dnOperation": "DC=digibee,DC=io",
"filter": "(objectClass=)",
"searchOperation": 0,
"useSsl": false,
"failOnError": false
}
}

Output

{
"result": [
{
"pwdhistorylength": "24"
},
{
"msds-alluserstrustquota": "1000"
},
{
"otherwellknownobjects": [
"B:32:683A24E2E8164BD3AF86AC3C2CF3F981:CN=Keys,DC=digibee,DC=io",
"B:32:1EB93889E40C45DF9F0C64D23BBB6237:CN=Managed Service Accounts,DC=digibee,DC=io"
]
}
]
}

Operation ADD

Input

{
"type": "connector",
"name": "ldap-connector",
"accountLabel": "ldap",
"stepName": "ldap",
"params": {
"operation": "ADD",
"host": "LDAP_IP",
"port": 389,
"dnAuthentication": "DC=digibee,DC=io",
"entries": "{{ message.$.entries }}",
"dnOperation": "DC=digibee,DC=io",
"useSsl": false,
"failOnError": false
}
}

Payload

{"entries": {
"objectClass": ["top", "person"],
"cn": "test_ad",
"sn": "test_sn"

}
}

Output

{
"message": "Entry added successfully",
"success": true
}

Operation MODIFY

Input

{
"type": "connector",
"name": "ldap-connector",
"accountLabel": "ldap",
"stepName": "ldap",
"params": {
"operation": "MODIFY",
"host": "LDAP_IP",
"port": 389,
"dnAuthentication": "DC=digibee,DC=io",
"entries": "{{ message.$.entries }}",
"dnOperation": "DC=digibee,DC=io",
"modifyOperation": 0,
"useSsl": false,
"failOnError": false
}
}

Payload

{"entries": {
"objectClass": ["top", "person"],
"cn": "test_ad",
"sn": "test_sn"

}
}

Input

{
"message": "Entry modified successfully",
"success": true
}

Operation DELETE

Input

{
"type": "connector",
"name": "ldap-connector",
"accountLabel": "ldap",
"stepName": "ldap",
"params": {
"operation": "DELETE",
"host": "LDAP_IP",
"port": 389,
"dnAuthentication": "DC=digibee,DC=io",
"dnOperation": "DC=digibee,DC=io",
"useSsl": false,
"failOnError": false
}
}

Output

{
"message": "Entry modified successfully",
"success": true
}

LDAP supports static Double Braces in the following parameters previously specified:

  • operation

  • host

  • dnAuthentication

  • port

  • modifyOperation

  • searchOperation

  • useSsl

To read our article about Double Braces, click here.

Did this answer your question?