Impersonation in a .Net core application with Identity Server 4

Impersonation in a .Net core application with Identity Server 4

Venkatesan Rethinam's photo
Venkatesan Rethinam
·Dec 8, 2021·

1 min read

Subscribe to my newsletter and never miss my upcoming articles

Identity Server 4 does not provide native impersonation support which I needed for one of my projects. I have implemented one on top of it.

Here is the sample project I did on GitHub.

github.com/venbacodes/ImpersonationSample-I..

This is a sample application to show a way to implement impersonation when using Identity Server.

Key Points

  1. Authorization policy has been set up to restrict impersonation to users with specific roles.
  2. Admin users' email is added as a claim while impersonating so that it can be used while ending the impersonation.
  3. Logic is simple as authenticating with the victim users' email for impersonation with additional claims to track the impersonation and the impersonating user.
 
Share this