How to use multiple classes as User in Identity - Asp.Net Identity

3

I want to use 2 classes as User in Identity and I could not see this change in the code.

Let's assume that I will use the default class "ApplicationUser" which generates an "AspNetUsers" table and I want to use another "Customers" table that inherits from Identity.

The ApplicationUser class already inherits from Identity and works fine. I saw that there is an ApplicationUserManager class and others that inherit from ApplicationUser. Example:

public class ApplicationUser : IdentityUser

public class ApplicationUserManager : UserManager<ApplicationUser>

public class ApplicationSignInManager : SignInManager<ApplicationUser, string>


public class Cliente: IdentityUser

My question is whether I will need to create new classes to inherit from Client, eg:

public class ApplicationUserManagerCliente : UserManager<Cliente>
public class ApplicationSignInManagerCliente : SignInManager<Cliente, string>

Would that be or am I thinking wrong?

    
asked by anonymous 09.02.2015 / 20:11

1 answer

-1

As far as I understand, you want to create two types of users: UserEntity and System Administrator (AdminUserEntity). The UserEntity will access the normal site and the Administrator will access another site (adm).

Given that it would be ideal, create a single user with the default characteristics between the 2 and give them Specialized Claims, eg Profile = Admin, AccessSites = OtherSite.

See if this link here can help you: link

have a tutorial that can help you: link

    
02.04.2015 / 21:33