Q47: How do you handle User Impersonation securely in administrative systems using JWTs?

Difficulty:AdvancedTopic:Advanced Patterns

Administrative user impersonation allows support agents to view systems as a target customer without requesting the user's password.

Secure Pattern:

  1. Require the admin to perform step-up MFA before requesting impersonation.
  2. Auth server issues an Impersonation Token containing explicit actor claims (act claim per RFC 8693).
  3. Payload includes sub: "user_123" (target customer) alongside act: { "sub": "admin_456" } (actual administrator).
  4. Audit logging systems record both the target user ID and the acting administrator ID for compliance logging.
Key Takeaways
  • Use RFC 8693 Actor (act) claims to distinguish the acting admin from the target subject user.

  • Always log impersonated actions in audit databases for security compliance tracking.