Resource based authorization with Azure AD?

蓝咒 提交于 2019-12-02 02:27:54

问题


Here is the scenario, I have a service containing many records. My service also has many users, each with the ability to create, read, update and delete records. The ability to perform these operations on each record must be controlled at the record level.

For example, user A can only read and update record 1 but user B can read, update and delete records 1, 2 and 3 and user C can perform all operations on all records.

How if at all, can this be done using Azure AD?

Obviously, using application roles is not sufficient because that gives the user uniform access rights to all records.

The tenant is also not useful because its the same for all users (in this example).

I definitely do not want to define access rights for every record individually, I would like to do something like assigning roles to a user group and then somehow assign records to the group.

Is there a standard way to deal with this type of resource based authorization?


回答1:


As you correctly mention, role based access or authorization is very generic and using that, a user with specific role gets access (or gets denied access) to all resources. (If your sceanrio permits, you could make it a little better by dividing your resources into a few types and give access for 1 or more types of resources to 1 or more roles).

When trying to control access for each record individually, you will need to implement custom logic for resource based authorization. Typically applications utilize a mix of role-based and resource-based authorization driven by their requirements.

In the end it will boil down to a mapping that you need to maintain between 3 things

  • Resource (or a collection of resources)
  • Azure AD object (like role, group, individual user that is being given permission)
  • Permission that you're giving (understood and enforced by your application e.g. Blogs.Create permission for a Blogs application)

Relevant Documentation available on Microsoft Docs

Role-based and resource-based authorization

This documentation talks about similar concepts and shows a good example which makes use of both role based and resource based. CRUD operations on resources based on roles and then special privileges on specific resource for the owner of that resource (i.e. resource based)

Code Samples

  1. Multi-tenant Survey Application Code

    Code base for the documentation link above

  2. Authorization in a web app using Azure AD groups & group claims

    This one provides a sample task tracker application where users can share tasks with other users or Azure AD groups. Again you will see a mapping between resources (i.e. tasks in this case) and Azure AD objects (i.e. Users or Groups) is being maintained in sample database.

Assigning Application Roles for groups

Since you mentioned this as part of your question, just letting you know that this is possible from Azure Portal but only if you have Azure AD Premium license (I'm not sure which specific ones support it, but search on Group based assignments feature and you'll find it.)



来源:https://stackoverflow.com/questions/54856704/resource-based-authorization-with-azure-ad

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!