I have two different entities Staff
and Customer
that have different attributes and behaviors, each of them has a separate login system. I'm intending to use the ASP.NET Identity to manage the login, role, claim etc. of each entity.
Is it possible and best practice to use each Identity system for each entity? My idea would be something like: AspNetUser
will become Staff
and Customer
, AspNetUserRole
will become StaffRole
and CustomerRole
, etc.
What will be the appropriate solution to my problem? (Without merging the Staff
and Customer
to User
entity).
Everything you've described so far can be accomplished with a single standard identity instance using role based authorization with a staff
role. Both your Staff
and Customer
object can have a one-to-one reference to an AspNetUser
instance.
You can have two registration methods, RegisterNewUser
and AddStaffMember
. The RegisterNewUser
method will just create a new AspNetUser
instance while the AddStaffMember
method will create a new AspNetUser
instance and add an AspNetRole
instance with the value of staff
. The RegisterNewUser
method will be accessible anonymously while the AddStaffMember
method will gate access to only allow users with the staff
role
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.