Answer the question
In order to leave comments, you need to log in
How to change the project to screw asp.net Identity instead of self-written authentication?
There is a project, authentication was written independently, the principle is something like this:
Upon successful password verification, a user instance was placed in the session, then the presence of an instance in the session was checked with self-written filters. There was also a helper that, based on the context of the request, returned a user instance and, based on this, the logic in the view and in controllers changed, and was forwarded to services. There was also a feature to change the user. The admin could select any user and his instance of this user was placed in the session.
Now we need to remove the self-signature and add asp.net identity. I encountered a lot of problems when initially attaching identity to the project, such as localization, the inability of standard managers to make a two-factor on 1 page, etc. The question is how to implement a helper that would return an ApplicationUser instance based on the request context. How it is possible to implement a counter of "substitution" of the user? (So that the admin can pretend to be any user or change the role to any, temporarily)
So far I have thought of using the cache in the form of a userid applicationUser dictionary, but I think this is a bad decision.
Answer the question
In order to leave comments, you need to log in
Say strange things. UserManaget contains two methods
We can easily implement everything on 1 page, nothing limits you in this.
The only thing is that you need 2 controller actions, just call them with AJAX.
Localization is all based on resources, there are resources for the Russian language in nuget.
To implement the "substitution" of the user, you can use abstractions from ASP Identity. Select the desired user, do SignOut for the current one and then SignIn for the selected one. In Claims, you can add an admin role to keep the admin experience.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question