ASP.NET Text File Identity Provider
I am creating a simple ASP.NET 5 website using ASP.NET Identity 2 to protect the passwords of the actual admin pages. It will be used by 2 to 4 users.
My employer does not want me to use the database for various reasons beyond my control. The plan is to store all user information in a text file. When a user needs to be added / removed, the developer will log into the server and update the text file. Thus, users can only log in to the system, they cannot register, change their password, etc.
I would like to use an ASP.NET Identity anyway to use the Authorize attribute for my MVC controllers, etc. It also makes it easier to start using the database later.
I was unable to find an ASP.NET Identity Provider that uses an unencrypted text file. Does such a provider exist anywhere?
source to share
I have not come across text file storage, but I have seen many examples using some other storage engines. Check out this post for samples and check out the documentation on implementing custom storage.
In your case, I would store all the custom objects in a list and then serialize that to a JSON string, which is stored in a file.
However, it is strongly recommended not to use plain text for storing passwords and use the provided hashing mechanisms. (I'm sure you know that). Just point your employer to http://plaintextoffenders.com/ for examples of why it is best not to store your password in clear text.
source to share
While I was trying to understand how asp.net Indentity works, I put together a sample solution in which I explore setting up a provider to use a simple store.
You can find the code on github .
In the Custom.Identity folder , you can see how I have implemented the different classes and managers.
Trailmax has written a lot about this on his blog. Taiseer Joudeh has one written to help you understand all the parts involved.
source to share