Batch / Scheduled Tasks
This sections helps to understand purpose of batch tasks in OpenIAM, explains idea of out of the box tasks.
Batch task
Usage of batch task provides ability to support any kind of business logic (like sending out notifications, build custom reports other periodical routine tasks). OpenIAM provides set of out of the box batch tasks, some of them can be customized via groovy scripts, some should remained as delivered. Below you can find descriptions.
Running a shell script with a batch task
If running sh. is required/necessary, you can use the following a code reference:
ProcessBuilder processBuilder = new ProcessBuilder()println "parameter_1: " + parameter_1println "parameter_2: " + parameter_2processBuilder.command("bash", "-c","sh /tmp/script.sh ${parameter_1} ${parameter_2} ")try {Process process = processBuilder.start()BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))StringBuilder output = new StringBuilder()String linewhile ((line = reader.readLine()) != null) {output.append(line)}println("Script output:" + output)} catch (IOException e) {e.printStackTrace()} catch (InterruptedException e) {e.printStackTrace()}
Due to security reasons, java.io package is not in the whitelist of imports (you can't just instantiate classes of this package in groovy). To tackle that add
-Dorg.openiam.groovy.extra.whitelist.package=java.io
file for groovy-manager and esb, as follows:
into openiam-docker-compose/3.2/services/docker-compose.yaml (for Docker) or to /etc/systemd/system/openiam-groovy.service and /etc/systemd/system/openiam-esb.service (for RPM).
For example,git status for RPM:
ExecStart=/usr/local/openiam/services/start.sh groovy-manager "-Xmx512m -Djdk.tls.client.protocols=TLSv1.2-Dorg.openiam.groovy.extra.whitelist.package=java.io
Out of the box tasks
Task name | Short description |
---|---|
[Access Certification Reminder](2-scheduledtasks#Access Certification Reminder) | Task sends out notifications for reviewers for uncompleted access review tasks |
[Access Certification reporting](2-scheduledtasks####Access Certification reporting) | Task sends out an access certification report to a UAR manager upon completion of campaign |
ACCOUNT_LOCKED_NOTIFICATION | Task sends out notification 'ACCOUNT_LOCKED' for all locked account at the moment |
Activate by Start Date | Task initiates user activation process |
Activation reminder | Task sends out notification NEW_USER_ACTIVATION_REMIND to users with status PENDING_INITIAL_LOGIN and created recently |
AUTO_UNLOCK | Deprecated, will be deleted in 4.2.1.3 Release |
Clean Auth State table | System task. Task set AUTH_STATE=0 in rows where LAST_LOGIN less then 24h and delete rows where LAST_LOGIN older than 30 days in table AUTH_STATE |
Clean Resource For Completed Requests | Legacy. Deprecated, will be deleted in 4.2.1.3 Release |
Cleanup OLD CSV Files | Task deletes CSV files attached in sync configurations more than year ago |
Delete/Deactivate by last Data | Task sets status DEACTIVATE to users with status PENDING_DEACTIVATION and deletes user with status PENDING_DELETE |
Disable by last date | Task to implement termination process. Picks up set of users to be terminated and performs termination for them |
Escalation of expired requests | Task initiates escalation of access requests if approvers expired SLA |
Failed provision requests report | Task compiles and sends our report about failed provisioning events |
Group Attestation | Legacy. Deprecated, will be deleted in 4.2.1.3 Release |
INACTIVE_USER | Task picks up users who haven't logged in for 90 days, deactivates their accounts and sends our notification ACCOUNT_INACTIVE |
Notification of expiring/revoke of expired access | Task picks up users with access that is about to expired and sends our notification ACCESS_IS_ALMOST_EXPIRED. Also task initiates revoke access wrokflow for expired access |
Notification reminders for approvers | Task sends out notification APPROVER_REMINDER to approvers who didn't make decision for pending requests |
PASSWORD_EXPIRED | Task sends out email notification PASSWORD_EXPIRED to users with expired password |
PASSWORD_NEAR_EXP | Task sends out email notification PASSWORD_NEAR_EXPIRATION to users with almost expired password |
Perform Business Rules recalculation | Tasks applies recent changes in business rules to all user set |