README
Async reconciliation Sample
---------------------------
Copyright (c) 2012 ForgeRock AS
This work is licensed under a Creative Commons Attribution-
NonCommercial-NoDerivs 3.0 Unported License. See
http://creativecommons.org/licenses/by-nc-nd/3.0/
This sample demonstrates how to perform an asynchronous action from a
reconciliation.
For documentation pertaining to this example see:
http://openidm.forgerock.org/doc/install-guide/index.html#more-sample9
To try the sample, follow these steps.
1. Start OpenIDM with the configuration for sample 9.
$ cd /path/to/openidm
$ ./startup.sh -p samples/sample9
2. Run reconciliation.
$ curl -u openidm-admin:openidm-admin -X POST "http://localhost:8080/openidm/recon?_action=recon&mapping=systemXmlfileAccounts_managedUser"
4. The reconciliation starts an approval workflow for each ABSENT user.
These workflows (managedUserApproval) wait for approval.
5. Query the started workflow task instances.
$ curl -u openidm-admin:openidm-admin "http://localhost:8080/openidm/workflow/taskinstance?_queryId=query-all-ids"
sample response:
{"result":[{"_id":"26","name":"Evaluate request"},{"_id":"16","name":"Evaluate request"}]}
6. Approve the requests.
$ curl -u openidm-admin:openidm-admin -X POST "http://localhost:8080/openidm/workflow/taskinstance/16?_action=complete" --data '{"requestApproved": "true"}'
$ curl -u openidm-admin:openidm-admin -X POST "http://localhost:8080/openidm/workflow/taskinstance/26?_action=complete" --data '{"requestApproved": "true"}'
7. Query the managed users created by the asynchronous reconciliation after
the approval step.
$ curl -u openidm-admin:openidm-admin "http://localhost:8080/openidm/managed/user?_queryId=query-all-ids"
To test the sample you might want to copy the following into an executable text file and run it:
echo "copy the workflow and wait for 3 seconds to deploy"
cp openidm/samples/sample9/workflow/managedUserApproval.bar openidm/workflow/
sleep 3
echo "run recon and then wait for 3 sec to get the instance id"
curl -u openidm-admin:openidm-admin -X POST "http://localhost:8080/openidm/recon?_action=recon&mapping=systemXmlfileAccounts_managedUser"
sleep 3
curl -u openidm-admin:openidm-admin "http://localhost:8080/openidm/workflow/taskinstance?_queryId=query-all-ids"
echo ""
echo "now run the following after replacing XX with the taskinstanceNumber (the _id property) from above!"
echo 'curl -u openidm-admin:openidm-admin -X POST "http://localhost:8080/openidm/workflow/taskinstance/XX?_action=complete" --data '\''{"requestApproved": "true"}'\'