We have a Sitecore MVC website. The Sitecore version is 9.3.0.

As of now, we have login functionality on the website. We use 'AuthenticationManager.Login' method and pass 3 parameters(username, password and persistent).

We have a new requirement that one user(let's consider as a superuser) should be able to log in using his credentials. Once the superuser is logged in, he will be able to impersonate another user(using only the userId and without entering a password).

So now two sessions are active. One is the actual superuser logged in using his credentials. The second is the impersonating user. While impersonating, he can do few operations on the website like ordering something or managing his profile details, etc.

Superuser must be able to stop the impersonation and also to log out from his account. Can you please help me on how to achieve this requirement? Please share your thoughts/inputs on this requirement.

  • As you mentioned that it's a custom implementation. So are you maintaining the user's session in the database? Oct 13 at 8:31
  • @SumitBhatia We are using 'AuthenticationManager.Login' method and passing 3 parameters(username, password and persistent). I don't think it's a complete customization but using the methods provided in sitecore dlls.
    – Thanoj
    Oct 13 at 9:21
  • Are the operations controlled by your code? Could you for example set some value in the session that the super user is impersonating someone else and have your code look at that? Or does the whole context actually need to get changed e.g. if you do Sitecore.Context.User you need to see the impersonated user instead of superuser?
    – Jeroen
    Oct 13 at 18:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.