IAM: Permission Mirroring
Permission mirroring automatically creates and maintains equivalent permissions in other modules when a permission is defined in a source module. It allows administrators to grant access in one place while target modules receive the access they need without duplicating manual permission management.
Mirroring is driven entirely by configuration supplied with the IAM deployment. Target modules do not implement mirroring logic themselves; they consume mirrored permissions through the same IAM permission model as any other permission.
Overview
When a permission belongs to a configured source module, IAM can produce one mirrored permission per configured target module. Each mirrored permission:
- Belongs to the target module and uses that module's role vocabulary (which may differ from the source).
- Carries the same context as the source permission (entities and entity groups).
- Is read-only — it cannot be created, edited, deleted, or assigned directly. All changes flow from the source permission.
- Is linked to its source permission so administrators can see which mirrors exist and trace a mirror back to its origin.
Mirrored permissions never trigger further mirroring.
When Mirroring Runs
Mirroring is applied automatically whenever the source permission changes:
| Action on source permission | Effect on mirrors |
|---|---|
| Create | Mirror permissions are created for each target where mapping produces roles. |
| Update | Mirrors are synchronized: mirrors that no longer match are deleted; new mirrors are created; unchanged mirrors are kept. Current assignees are applied to newly created mirrors. |
| Delete | All linked mirror permissions are deleted (before the source is removed). |
| Assign to user or group | The same user or group receives all linked mirror permissions. |
| Unassign from user or group | The same user or group is removed from all linked mirror permissions. The source permission itself remains. |
| Assign to client service account | The client's service account receives all linked mirror permissions. |
| Remove client permission | The permission is deleted (including all mirrors), not merely unassigned from the client. |
If a source permission is created or assigned but no mirror definitions apply, no mirror permissions are created.
Read-only (mirrored) permissions cannot be modified or assigned on their own. API operations that target a mirror directly are rejected; operators must work with the source permission.
Permission-change notifications and forced logouts apply only to operations on source permissions. Mirror lifecycle operations are silent and best-effort — failures are logged but do not fail the primary operation on the source permission.
Configuration Model
Configuration defines, for each source module, one or more target modules and how source roles map to target roles.
Source module
The module name of the permission that triggers mirroring (matched against the permission's module field, case-insensitive).
Target module
The module that receives the mirrored permission. Each source module may map to multiple targets; each target yields one mirrored permission per source permission.
The target module must already be registered in IAM. Unregistered targets are skipped silently (no mirror is created). If a target module registers later, mirrors are not backfilled automatically — they appear only after the next create or update on the source permission.
Default roles in target
Optional roles that are always included in the mirrored permission for that target, regardless of whether any mapping rule matches the source permission.
- Defaults are applied before mapping rules.
- If
defaultInTargetis configured and at least one default role is defined, a mirrored permission is always created for that target — even when no rule matches the source roles. The mirror then contains only the default roles (plus any roles added by matching rules). - If
defaultInTargetis not configured (or empty) and no rule produces any role, no mirrored permission is created for that target.
This is useful when every mirror in a target module should include a baseline role (for example, a module identifier or a minimum access level) in addition to roles derived from the source.
Mapping rules
Rules describe how source roles translate into target roles. Each rule has a from side (what to match on the source permission) and a to side (what to add on the mirrored permission).
- From — role type (required): The role category on the source permission (for example
action,resource,access). - From — role value (optional): A specific value within that category. If omitted, the rule applies to all values of that type that are not already handled by a more specific rule.
- To — role type (required): The role category on the mirrored permission.
- To — role value (optional): The value to set on the mirror. If omitted, the source value is copied (for wildcard rules) or the matched source value is reused (for specific rules).
Rules are evaluated in two passes:
- Specific rules (from side includes a role value) run first. Each matched source value is mapped and is then excluded from wildcard handling.
- Wildcard rules (from side has no role value) run on any remaining values for that role type.
If several rules contribute the same role type and value on the mirror, the value appears only once.
Module names and role values are matched case-insensitively.
Role vocabulary alignment
Mapping configuration must use role types and values that the target module actually recognizes. Mirrored permissions are created directly from configuration; they do not pass the same validation pipeline as permissions created through the IAM UI or API by an administrator.
If a rule maps to a role type or value the target module does not use, the mirror permission may exist in IAM but the target application will not grant the intended access. Source and target module teams should agree on mappings before configuration is published.
Configuration constraints
- Each source module may appear only once in the configuration.
- Each target module may appear only once per source module.
Violations cause startup initialization to fail with an error log. The host process may keep running, but IAM initialization does not complete and mirroring behavior is undefined until the configuration is corrected and pods are restarted.
Configuration Schema
The mirroring configuration is a JSON document with a single top-level key PermissionMirroring that contains an array of source-module configurations:
{
"PermissionMirroring": [
{
"sourceModule": "IAM-Module",
"targets": [
{
"targetModule": "module-mock",
"defaultInTarget": [
{ "typename": "access", "role": "reportViewer" }
],
"rules": [
{
"from": { "typename": "action", "role": "manage" },
"to": { "typename": "access", "role": "holidaysAdmin" }
},
{
"from": { "typename": "resource" },
"to": { "typename": "dataCollection" }
}
]
}
]
}
]
}
Structure
| Level | Field | Required | Description |
|---|---|---|---|
| Root | PermissionMirroring |
Yes | Array of source-module configurations |
| Source | sourceModule |
Yes | Module name to match against the source permission's Module field |
| Source | targets |
Yes | Array of target-module mappings |
| Target | targetModule |
Yes | Module name set on the mirrored permission |
| Target | defaultInTarget |
No | Roles always included in the mirrored permission regardless of rule matches |
| Target | rules |
Yes | Array of from/to mapping rules |
| Rule | from |
Yes | Match criteria against the source permission's roles |
| Rule | to |
Yes | What to emit in the mirrored permission |
| RoleRef | typename |
Yes | The role type key (e.g. action, resource, access, dataCollection) |
| RoleRef | role |
No | Specific role value. When omitted in from, matches all values. When omitted in to, copies the source value. |
Operational Notes
- Empty configuration — No mirroring occurs; permissions behave as if mirroring were disabled.
- Unconfigured source module — Permissions in modules not listed as sources are not mirrored.
- Configuration updates — Mirroring rules are captured at startup. Updating the ConfigMap requires a backend pod restart for changes to take effect. Even after a restart, existing mirrors are only reconciled when each source permission is next created, updated, assigned, or deleted — there is no automatic bulk reconciliation.
- Failure handling — Mirror create, assign, or delete failures are logged but do not block the primary operation on the source permission. Operators should monitor logs if mirrors are missing after changes.
- Client cleanup — Deleting a client removes its permissions via cascade delete, which deletes linked mirrors as well.
Summary
| Topic | Behavior |
|---|---|
| Trigger | Permissions in a configured source module |
| Output | One read-only mirrored permission per target module (when mapping produces roles) |
defaultInTarget |
Always included; alone can cause a mirror to be created when no rules match |
| Context | Entities and entity groups copied unchanged from source |
| Lifecycle | Mirrors follow create, update, delete, assign, and unassign on the source |
| Client removal | Deletes source permission and all mirrors (not mirror-only unassign) |
| Direct mirror edits | Not allowed; modify or assign the source permission |
| Target module code | No mirroring implementation required; use effective permissions as usual |
| Role mappings | Must match target module vocabulary; misconfiguration may not block mirror creation |
| Recursion | Mirrored permissions do not trigger further mirroring |
| Rule priority | Specific rules before wildcards; matched values excluded from wildcards |
| Deduplication | Duplicate role values on a mirror are collapsed |
| Notifications / logout | Apply to source permission changes, not to mirror-only operations |
| Configuration owner | Platform / ops team at deployment; not end-user configurable |
See Also
- IAM Roles and Permissions Model — Role types, permission structure, and the
getRolescontract - Module Integration with IAM — Module registration and integration overview
- IAM Helm Chart Configuration — Full chart values reference