ASP.NET Identifier - User UserManager, UserStore

I am a little confused about setting up UserManager and UserStore. An exceptional solution comes with an EF implementation, and I don't want to use EF, but my own DAL, which uses MSSQL. I want to have requirements-based protection when one of the claims of users will be the role.

What I'm confused with is the general process that I have to do. From what I still do not understand, I need to make my own

CustomApplicationUser : IUser CustomUserManager : UserManager<CustomApplicationUser> CustomUserStore : IUserStore, IUserClaimStore 

Questions:

  • Am I on the right track with this?
  • I want to use the IsInRole () method in my CustomUserManager, but I don’t know how to do this with the claims. I know that there is IUserRoleStore.IsInRole (), which by default calls UserManager in UserManager.IsInRole (), but I do not need a separate Roles table in my database. What I want is a Claims DBs table with one of the ClaimType type being Role, and this UserManager.IsInRole () uses this. Now, I'm not sure why I need the UserManager.IsInRole () method? Should I actually have something like custom ClaimsIdentity SignInManager.CreateUserIdentityAsync (), and as part of this call, my own implementation fills in all the user information, including complaints?

It seems to me a little confusing, and I can not find clear documentation about this, so if someone can shed some light, I would really appreciate it!

+5
source share
1 answer

Instead of just copying, I’ll just point you to the following article: Browse custom storage providers for ASP.NET authentication .

Take a look at this, it should give you a good overview of how an identifier works in ASP.NET. It is also useful for choosing what you want to override and customize in your application.

+5
source

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


All Articles