User Impersonation — a secure, easy way to troubleshoot remotely

What is User Impersonation?

Priyanka
Deskera Engineering
3 min readApr 27, 2020

--

User Impersonation allows Administrators to access and operate as if they were logged in as that User.

Administrators can impersonate other authenticated users for testing purposes and view impersonation logs.

Why is this feature important?

This feature is useful when testing permissions and content that only your Partner Users can see. For example, if a Partner User has encountered an issue while using the system, an Administrator can use the User Impersonation feature to troubleshoot.

When impersonating another user, the administrator has access to exactly what that user can access in the system, including the same menus and modules. The instance records anything the administrator does while impersonating another user as having been done by that user.

Impersonation limitations:

  1. Impersonations are logged in the System Log. The Server record impersonated activities for auditing.
  2. Impersonate user will be having a read-only access for user impersonation.

Introducing Super Token:

For implementing Impersonation we will be using a Super-Token, This Super token will belong to Impersonate user token. This super token is use for maintaining audit logs of a impersonate user and switching back to user environment once impersonation is done.

Implementation:

  1. Impersonate User Token : We will be creating a temporary token of a client in x-access-token and impersonate token in super-x-access-token

2. Impersonate Session : We will be creating one more session class for storing Impersonate user session details -

3. User Session and Ready Only Access : We need to store impersonal session data along with user session data using interceptors with read only permissions.

4. Audit: We are providing impersonate user id to Spring AuditAware to track and log impersonate user’s activity.

Conclusion:

Using super-x-access-token and x-access-token we can provide client access to a impersonate user with restricted permissions. Also, we can store all audit details with Impersonate user id for Auditing purpose. Maintaining impersonate User Session using super-x-access-token also help us in switching back to impersonate user account.

--

--