MATIH Platform is in active MVP development. Documentation reflects current implementation status.
6. Identity & Access Management
Impersonation
Overview

Impersonation Overview

User impersonation allows authorized administrators to assume the identity of another user for troubleshooting, support, and debugging purposes. The feature is designed with strict security controls and comprehensive audit logging to maintain compliance and prevent misuse.


How Impersonation Works

When an admin starts an impersonation session, the system generates a scoped token that grants the admin the same permissions as the target user. The admin can then make API calls and access the platform as if they were the target user.

Admin                   ImpersonationService         TokenService
  |                            |                          |
  |--- Start (target, reason)->|                          |
  |                            |--- Validate permissions--|
  |                            |--- Check constraints ----|
  |                            |--- Create session ------->|
  |                            |                          |--- Generate scoped token
  |                            |<-- Session info ---------|
  |<-- ImpersonationResult----|                          |
  |                            |                          |
  | (use scoped token for API calls)                      |
  |                            |                          |
  |--- End session ----------->|                          |
  |                            |--- Revoke token -------->|
  |                            |--- Record end time ----->|
  |<-- 204 No Content --------|                          |

Security Controls

ControlDescription
Role requirementADMIN role or users:impersonate authority required
Protected rolesCannot impersonate users with PLATFORM_ADMIN role
Reason requiredA reason of 10-1000 characters must be provided
Session limitMaximum concurrent impersonation sessions enforced
Auto-expirySessions expire after a configurable timeout
Full auditAll actions during impersonation are logged

Session Lifecycle

StateDescription
ActiveAdmin is currently impersonating the target user
EndedAdmin voluntarily ended the session
ExpiredSession exceeded the maximum duration
Force-endedAnother admin force-terminated the session

Section Pages

PageDescription
Starting SessionsHow to initiate an impersonation session with required parameters
Ending SessionsNormal termination, force-end, and auto-expiry
Audit TrailAudit logging, compliance reporting, and action recording