# Custom Reconciliation with Groovy Connector and REST API

**URL:** <https://community.openiam.com/t/custom-reconciliation-with-groovy-connector-and-rest-api/266>\
**Category:** Identity Life Cycle Management\
**Created:** [October 29, 2026, 2:50pm UTC](https://community.openiam.com/t/custom-reconciliation-with-groovy-connector-and-rest-api/266 "2026-10-29T14:50:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dan](https://avatars.discourse-cdn.com/v4/letter/d/eada6e/32.png) [@Dan](https://community.openiam.com/u/Dan)\
**Post date:** [October 29, 2026, 2:50pm UTC](https://community.openiam.com/t/custom-reconciliation-with-groovy-connector-and-rest-api/266/1 "2026-10-29T14:50:37Z")

</div>

Hello OpenIAM Team,

We are currently using OpenIAM Community Edition 4.2.1.14 with a custom provisioning architecture based on a Groovy connector, Kafka, and microservices.

Our existing connector handles provisioning operations, but it does not support searching for or retrieving users and their assigned roles from the target application.

We would like to implement user and role reconciliation by querying the target application’s REST API directly from a Groovy script, without modifying our existing provisioning architecture.

Our goal is to keep OpenIAM as the source of truth, comparing the user’s assigned access in OpenIAM against the actual roles in the target application.

We have the following questions:

Can OpenIAM reconciliation retrieve users and roles directly through a custom Groovy script, without implementing search operations in the existing connector?

What data structure or format does OpenIAM expect from the reconciliation script? How should the users and their assigned roles retrieved from the REST API be returned so that OpenIAM can process and compare them?

Are there any working examples or documentation for implementing this type of custom reconciliation in OpenIAM 4.2.1.14?

Thank you for your guidance.

---

<div class="post-metadata">

**Author:** ![ameet\_shah](https://yyz2.discourse-cdn.com/flex010/user_avatar/community.openiam.com/ameet_shah/32/17_2.png) [@ameet\_shah](https://community.openiam.com/u/ameet_shah)\
**Post date:** [November 10, 2026, 8:10pm UTC](https://community.openiam.com/t/custom-reconciliation-with-groovy-connector-and-rest-api/266/2 "2026-11-10T20:10:46Z")

</div>

Hello @Dan,

Thank you for the detailed description of your setup. Our answers are below.

1. Can reconciliation retrieve users and roles through a custom Groovy script?

Reconciliation retrieves target-side users and roles through the connector’s search handler, which is itself a Groovy script. It does not use a standalone reconciliation script for this.

- OpenIAM reconciliation always reads target-side data by sending a search request to the connector. The reconciliation config has no separate hook that fetches target data
- If you are using the OpenIAM Script Connector (script-connector-rabbitmq), this functionality is already supported. The connector includes a Groovy-based search handler, you can add a Groovy script that calls your REST API.
- Put the script’s path in the managed system’s SEARCH\_HANDLER attribute. To handle both users and groups, give two paths separated by ;, with the user script first.
- Your existing provisioning handlers (add, modify, delete and so on) stay unchanged.

1. What format does OpenIAM expect?

The script extends AbstractCommandExecutor\<UserConnectorObject, SearchUserProvisioningConnectorResponse\> and overrides perform(…). It returns a

SearchUserProvisioningConnectorResponse whose userList is a list of UserConnectorObject. For each user:

- identityName and identityValue carry the login.
- attributes is a list of StringConnectorAttribute, one per attribute.
- Add each value with addValue(new StringOperationalConnectorValue(value, AttributeOperationEnum.NO\_CHANGE)).
- For roles, use one multi-valued attribute such as ROLES, with one addValue call per role.
- Set the response status to ResponseStatus.SUCCESS.

Attribute names must match those in the managed system’s USER\_OBJECT policy map. The field used for matching in the reconciliation config must be present in every returned user.

Comparing roles against OpenIAM

- 
  - Create a reconciliation config on the managed system and map a ROLES attribute in the USER\_OBJECT policy map.
  - Use a population script (extending AbstractPopulationScript) to compare the target’s roles with the roles assigned in OpenIAM. Its execute(Map\<String, Attribute\> line, T pUser,

Map\<String, Object\> dataMap) method receives the target attributes in line.

- 
  - Per-situation custom command scripts can replace the default reconciliation actions, such as update resource from IDM or delete from resource. This supports your goal of keeping OpenIAM as the source of truth.

1. To confirm the approach and sharing an example, could you tell us:

- Is your Groovy connector the same as the OpenIAM Script Connector or a custom one? If it is custom, it must implement the search operation itself, using the same response format.
- Does your REST API support paging and filtering for users and roles? This affects how the search script is written.

If you can share a sample JSON response for one user with roles (with sensitive data removed), we can share an example as per your API structure.
