How to deal with deep level granularization with XACML in enterprise application

你说的曾经没有我的故事 提交于 2019-12-23 19:57:13

问题


I am using IS WSO2 for authorization with XACML. I am am able to achieve authorization for static resource. But I am not sure with the design when it comes to granularization.

Example : if I have method like getCarDetails(Object User) where I should get only those cars which are assigned to this particular user, then how to deal this with XACMl?

Wso2 provides support for PIP where we can use custom classes which can fetch data from database. But I am not sure if we should either make copy of original database at PDP side or give the original database to PIP to get updated with live data.

Because Cars would be dynamic for the application eg. currently 10 cars assigned to user Alice. suddenly supervisor add 20 more car in his list which will be in application level database. Then how these other 20 cars will be automatically assigned in policy at PDP level until it also have this latest information.

I may making some mistake in understanding. But I am not sure how to deal with this as in whole application we can have lots of this kind of complex scenario where some times we will get data for one user from more than 4 or 5 tables then how to handle that scenario?


回答1:


Your question is a great and the answer will highlight the key benefits of XACML and externalized authorization as a whole.

In XACML, you define generic, global rules, about what is allowed and what isn't using what I would call high-level attributes e.g. attributes of the vehicle (in your case) or the user (role, department, ...)

For instance a simple rule could be (using the ALFA syntax):

policy viewCars{
    target clause actionId=="view" and resourceType=="car"
    apply firstApplicable
    rule allowSameRegion{
        permit
        condition user.region==car.region
    }
}

Both the user's region and the car's region are maintained inside the application's database. The values are read using a PIP or Policy Information Point (details here).

In your example, you talk about direct assignment, i.e. a user has been directly assigned to a vehicle. In that case, the rule would become:

policy viewCars{
    target clause actionId=="view" and resourceType=="car"
    apply firstApplicable
    rule allowAssignedVehicle{
        permit
        condition user.employeeId==car.assignedUser
    }
}

This means that the assigned user information must be kept somewhere, in the application database, a CSV file, a web service, or another source of information. It means that from a management perspective, an administrator would add / remove vehicles from a user's assigned list (or perhaps the other way around: add / remove assigned users from a vehicle's assigned user list).

The XACML rule itself will not change. If the supervisor adds 20 more cars to the employee's list (maintained in the application-level database), then the PDP will be able to use that information via the PIP and access will be granted or denied accordingly.

The key benefit of XACML is that you could add a second rule that would state a supervisor can see the cars he/she is assigned to (the normal rule) as well as the cars assigned to his/her subordinates (a new proxy-delegate rule).

This diagram, taken from the Axiomatics blog, summarizes the XACML flow:

HTH, let me know if you have further questions. You can download ALFA here and you can watch tutorials here.



来源:https://stackoverflow.com/questions/27626555/how-to-deal-with-deep-level-granularization-with-xacml-in-enterprise-application

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