1

I've looking around for an answer to the question: "can Identity 2.0 be extended to allow the same user to have different roles on different scenarios"? In other words, can I extend the AspNetUserRoles to have 1 or more custom columns? I have seen some examples on how to add new fields to the Roles table but not to the relationship between Users and Roles.

Adding new columns to AspNetUserRoles would allow me to assign UserX a RoleA in ScenarioA and a RoleB in ScenarioB.

I want to stick to the native authorization mechanism but don't want to fiddle with it in ways that it was not meant to. In that case, I'll build my own tables.

Does someone know of a way to accomplish this?

Thanks!

Mauricio Ramalho
  • 849
  • 1
  • 8
  • 15
  • 1
    Your problem can be addressed by same approach which I described in [this question](http://stackoverflow.com/questions/29988858/custom-authentication-and-authorization-based-on-user-rights/31755231#31755231). – Sam FarajpourGhamari Apr 04 '17 at 17:58
  • Hi @SamFarajpourGhamari, thanks for the reply. The approach you describe is interesting. I could fill the claims with data from my own tables after ScenarioA or ScenarioB have been chosen. But with this solution, I need to create my own tables. The tables AspNetRoles, AspNetUserRoles and AspNetUserClaims will be empty. – Mauricio Ramalho Apr 04 '17 at 20:32

0 Answers0