Skip to content

About

Role Based Access Control plugin for OIE (Open Integration Engine)

Resources

Stars

4 stars

Watchers

0 watching

Forks

Repository files navigation

Role Based Access Control for OIE

Role Based Access Control (RBAC) plugin for Open Integration Engine 4.7.0. Enforces dynamic roles with per-permission grants and channel-level restrictions, replacing the engine's default always-allow authorization controller.

Running OIE 4.6.0? Use rbac 1.1.4.

Web admin ready: the same zip ships both UIs. Role management and role-based task gating work in the desktop (Swing) Administrator and in the OIE Web Administrator, with matching behavior in each. The web UI's permission gating is also more complete than Swing's, which cannot hide buttons inside panel bodies (an engine limitation that applies to all plugins); either way, denied operations always fail server-side. On servers where the Web Administrator isn't used, the web module is inert.

Data Pruner uses its own View Settings, Save Settings, and Start / Stop grants; channel Start/Stop permission does not grant pruning access. The web manifest marks RBAC as an authorization plugin so compatible web clients can stop startup if it cannot load. Failed permission loads stay closed until both permission APIs recover. Recovery restores the Roles tab when View Roles is granted. A page that showed Access denied while permissions were failing has to be opened again. Web client 1.1.0 or later is also required to hide Data Pruner actions and restricted navigation correctly; rbac 1.4.0 was tested against web client 1.1.0 and 1.3.0.

An unavailable permission snapshot gets at most three automatic retries, 15 seconds apart. Subsequent task checks retain the throttled lazy retry, and signing out cancels pending retries.

Full documentation is in the wiki.

Role-Based Access Control settings tab in the OIE Administrator

Role editor with grouped permission checkboxes and preset buttons

Known issues

Oracle: 1.1.2 does not work on an engine whose database is Oracle. The plugin fails to create its admin role on first startup, so after login the Administrator stops with 403 Missing permission: any (no role assigned), and creating a role fails with a NumberFormatException. Fixed in 1.1.3 (#10). Use 1.1.3 or later on an Oracle-backed engine.

Swing Administrator task buttons: In the desktop (Swing) Administrator, some task-pane buttons stay visible to users whose role doesn't allow them: the entries plugins add to the channel list and the channel editor, and the channel editor's own Debug Channel and Deploy Channel. The engine checks only a fixed set of buttons on those screens. Clicking one of these is refused by the server with a Missing permission message, and nothing runs. The web Administrator hides the channel editor's Debug Channel and Deploy Channel from those users (#8).

getProperty on OIE 4.7.0: the engine declares no permission on GET /api/server/property, which reads stored configuration values, so RBAC allows it to any user with a role. It can return the stored SMTP password (measured on OIE 4.7.0, 2026-11-16). OpenIntegrationEngine/engine#588 declares View Server Settings on it; once the engine ships that, RBAC enforces it with no plugin change.

Prerequisites

  • JDK 17
  • Maven 3.x
  • Network access on the first build: the engine jar script below downloads the OIE distribution, and the packaging step downloads Node.js v24.22.3 (via frontend-maven-plugin) to build the web administrator UI in webadmin/

Build

The plugin compiles against engine jars that are not published to a public Maven repository. Install them into your local Maven repository once per engine version:

./scripts/install-engine-jars.sh

The script downloads the OIE release matching the POM's mc.version, checks it against the SHA-256 pinned in the POM (oie.dist.sha256), and installs the five jars the build needs.

Then build the plugin:

mvn clean install

This runs the Java tests and the web UI's unit tests; -DskipTests skips both. mvn clean package works too, it just doesn't copy the jars into your local Maven repository.

The distributable zip lands at:

package/target/rbac-1.4.0.zip

Testing

mvn clean install runs the unit tests. CI also runs two end-to-end suites:

  • browser: the built web bundle loaded into the OIE web client, with the engine's REST API mocked (Playwright, webadmin/e2e).
  • e2e: the zip installed into the released engine through its own installer and driven over the REST API as real signed-in users, on every database the engine supports (Derby, PostgreSQL, MySQL, SQL Server with the jTDS and the Microsoft driver, Oracle), on Java 17 and 21. It runs a fresh install, an upgrade from each earlier release, and an uninstall.

To run e2e locally you need Java 17 or later, Docker for every database but Derby, and the OIE distribution for the POM's mc.version (oie_unix_4_7_0.tar.gz from the engine's release):

python3 e2e/run.py --db postgres --zip package/target/rbac-1.4.0.zip \
    --tarball oie_unix_4_7_0.tar.gz --work /tmp/rbac-e2e-1

What it covers, and what it leaves out, is in docs/design-notes.md.

Install

Install the zip through the Administrator's Extensions view and restart OIE. On first startup the plugin creates its four rbac_* tables and seeds an admin role assigned to every user the engine has at that moment (under the stock controller they were all admins). Users created later have no role until one is assigned.

Export and import roles

Roles can be written to a file and read back, on the same engine or another one. Users holding the admin role get Export Roles and Import Roles on the Role-Based Access Control settings tab, in both the desktop and the web Administrator; other users don't see them. The same is available through GET /api/extensions/rbac/roles/_export and POST /api/extensions/rbac/roles/_import. Only users holding the admin role can export or import. An import is previewed first, showing each role as it is on this engine now and as the import would leave it, with how each of the file's channels was found here; it writes only the roles picked, in one transaction, and never changes the admin role. Applying the file's channel restrictions is a choice. A channel whose id isn't on the engine but whose name matches one there is used only if you choose to match channels by name. The file format and the import rules are in docs/role-export-format.md.

The engine's own backup doesn't include rbac's roles or role assignments, or the engine's users. To move to a new engine, export the roles as well. On the new engine, install rbac, restore the backup, create the users, import the roles file, then assign the roles.

Role names are compared exactly as typed, so "Lab" and "LAB" are two roles. MySQL and SQL Server compare names ignoring case by default, so on those databases only one of the two can exist, and an import holding both asks you to rename one.

What RBAC enforces

RBAC checks each request against the permission declared for its operation. It reads three kinds of declaration at startup and, with the one exception below, keeps no list of its own:

  1. The engine's core API, through the permission on each operation.
  2. A plugin's own permissions, which the plugin registers with the engine.
  3. The permission on an operation of a servlet interface an extension registers with the engine, such as a connector's test calls. RBAC uses it when a role can be granted that permission, and a permission the plugin registers for the same operation comes first.

So when the engine or an extension declares a permission, RBAC enforces it with no plugin change. An operation that declares no permission is allowed for any logged-in user who has a role, and the server logs a warning each time (RBAC: allowing unknown operation ...). OIE 4.7.0 has dozens of these. Gating one belongs in the engine or the extension that owns it.

The exception is the engine's user preference calls (each user's Administrator settings), which declare no permission in OIE 4.7.0. RBAC requires Manage Users for another user's preferences and allows every user their own. Once the engine declares a permission on them, RBAC uses that instead.

A role stores a plugin's permission by its display name, the name the role editors show for it, such as "View Server Log" (Server Log), "View Settings" (Data Pruner) or "View Global Maps" (Global Maps). If a new version of the plugin renames the permission, or the plugin is removed, the role keeps the old name, and that grant does nothing. After a rename, the role's users are refused the plugin's operations until an admin grants the new name, and RBAC logs the role and the old name the first time one of its users is refused for a missing permission after the engine starts. The role editors don't show such a grant, and saving the role keeps it, so it comes back into use if the plugin is installed again. An admin can list and remove such grants with the Orphaned Permissions task in the RBAC tab; engine permissions are never listed there. Plugin authors: keep a permission's display name the same across versions.

The engine's plugin-settings calls (/api/extensions/{name}/properties) are allowed only under the exact name of an installed extension, and rbac's own settings only to the admin role.

Setting a user's role from another plugin

A plugin that signs users in, from a directory or an identity provider for example, can give each user an RBAC role through com.diridium.rbac.UserRoles. Call it by reflection, so your plugin has no build or install dependency on RBAC:

Class<?> userRoles;
try {
    userRoles = Class.forName("com.diridium.rbac.UserRoles");
} catch (ClassNotFoundException e) {
    return; // RBAC isn't installed, or is older than the first version with UserRoles
}
if (!(Boolean) userRoles.getMethod("isReady").invoke(null)) {
    return; // RBAC hasn't started
}
String result = (String) userRoles.getMethod("assign", int.class, String.class, String.class)
        .invoke(null, userId, "Billing", "My Sign-in Plugin");

Its static methods:

  • isReady(): whether RBAC has started.
  • roleNames(): every role's name, for a settings screen.
  • adminRoleName(): the admin role's name.
  • currentRoleName(userId): the user's role, or null when the user has none.
  • assign(userId, roleName, callerPlugin): gives the user the role and returns a code.

assign returns ASSIGNED, ALREADY_ASSIGNED, NO_SUCH_ROLE, LAST_ADMIN or NOT_READY. LAST_ADMIN means the user is the last user holding the admin role, so they keep it. assign throws IllegalArgumentException when no engine user has that id, and changes nothing. On an unexpected failure, such as the database being down, assign throws and the role is unchanged. The read methods throw IllegalStateException before RBAC has started. A Java caller using reflection gets these exceptions as the cause of an InvocationTargetException.

Roles are given by name, because role ids differ between engines. Names are compared exactly on every database, so "billing" doesn't find "Billing". assign applies the same last-admin check as Assign Role in the Administrator, refreshes the user's permissions at once, and records an audit event with the user, the role and the plugin name you pass. RBAC records that name as given and doesn't check it.

Role changes on one engine run one at a time, whether they come from assign or from the Administrator. If two changes at the same moment would each move one of the last two admins off the admin role, the second is refused. A user delete doesn't take part: the engine deletes the user after RBAC's last-admin check allows it. Engines that share one database don't wait for each other, and the other engines keep the permissions they cached before the change (#62).

Plugins that call RbacRepository and RbacAuthorizationController.invalidateCache directly should move to UserRoles. Those calls bypass RBAC's last-admin check, cache refresh and audit event, and don't wait for other role changes. They keep working for now, and the release notes will name the release that stops supporting them (#72).

If the RBAC tab can't list roles

A role whose name, permission or description contains a character XML can't carry, such as a bell (U+0007), stops the OIE Administrator and the web Administrator from listing roles. RBAC names it in mirth.log at startup, with its id. Delete it with curl -k -u admin -H 'X-Requested-With: OpenAPI' -X DELETE https://<engine>:8443/api/extensions/rbac/roles/<id>, then recreate it in the role editor. Deleting a role also removes it from its users, so assign them the new role.

License

MPL-2.0. See LICENSE.

About

Role Based Access Control plugin for OIE (Open Integration Engine)

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages