I am lost in all options that is possible for managing what a user can do and what a user can not do.
I started with Roles: [Authorize(Roles = Constants.Roles.ModeratorAndUp)]
. Where ModeratorAndUp is string "Moderators, Administrators"
.
But I need more flexible approach. For the past 3 hours I am reading about Claims and permissinos. I also found this interesting blog post.
I am using Angular and ASP.NET Core together with Universal template. For authentication I am using OpenIddict. I was following a book.
I want to use JWT token for authorisation and authentication. I don't know how permission should be handled in .NET Core, but I have 100 different Roles and it is complete mess. And also when I create new user, I need to manually add it arround 20 roles. It would be nice If I could create Groups which has Roles/Permissions and then add User to this group. But don't know how this design will play with OpenIdDict and JWT token authorisation.
Can someone point me in the right direction, and then I will research on my own.
I am not sure should I build some system that will automatically update user roles when I change Group Permissions/Roles, should I go with Claims ... I would like to use [Authorize]
attribute, because it really simplify things.
What/how/which is the best practice to do JWT Token authentication/authorisation in ASP.NET Core.