Asp.net mvc 5 user authentication without using Microsoft.AspNet.Identity.EntityFramework

How to create custom ASP.NET MVC 5 Auth without using Microsoft.AspNet.Identity.EntityFramework user repository ??

+6
source share
2 answers

All you have to do is implement the same interfaces that the custom store uses for Identity.Entityframework .

User will be your user class.

 public class MyUserStore<TUser> : IUserLoginStore<TUser, int>, IUserClaimStore<TUser, int>, IUserRoleStore<TUser, int>, IUserPasswordStore<TUser, int>, IUserSecurityStampStore<TUser, int>, IUserStore<TUser, int>, IDisposable where TUser : User { //Implement the interfaces you need } 

Then pass MyUserStore to UserManager every request

 new UserManager<User, int>(new MyUserStore<User>(new MyContext())) 
+2
source

You can grab the UserStore.cs template from the next project on GitHub and configure it however you want, it will allow you to get rid of the dependency on Microsoft.AspNet.Identity.EntityFramework.

https://github.com/kriasoft/AspNet-Server-Template → ./src/App.Server/Data/UserStore.cs

(disclaimer: I am the author of this project template)

0
source

Source: https://habr.com/ru/post/974312/


All Articles