如何在企业应用程序中使用XACML处理深层粒度 [英] How to deal with deep level granularization with XACML in enterprise application

查看:109
本文介绍了如何在企业应用程序中使用XACML处理深层粒度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用IS WSO2进行XACML授权。我能够获得对静态资源的授权。



示例:如果我有像getCarDetails(Object User)这样的方法,那么我应该只得到那些分配给该特定用户,那么如何用XACMl处理呢?



Wso2提供了对PIP的支持,在这里我们可以使用可以从数据库中获取数据的自定义类。但是我不确定我们应该在PDP端复制原始数据库还是将原始数据库交给PIP以获取实时数据更新。



因为汽车会动态的应用程序,例如目前已将10辆汽车分配给用户Alice。突然,主管在他的列表中添加了20多辆汽车,这些汽车将存储在应用程序级别的数据库中。然后,如何在PDP级别上自动将其他20辆车分配到策略中,直到它也具有此最新信息。



我在理解上可能会犯一些错误。但是我不确定如何处理这个问题,因为在整个应用程序中,我们会遇到很多这种复杂的情况,有时我们会从4个或5个以上的表中为一个用户获取数据,然后如何处理该情况?

解决方案

您的问题很棒,答案将突出显示XACML和整个外部授权的主要好处。



在XACML中,您定义通用的全局规则,关于允许的内容和不使用的内容使用我所谓的高级属性,例如车辆(在您的情况下)或用户(角色,部门等)的属性



例如,一个简单的规则可能是(使用ALFA语法):

 策略viewCars {
target子句actionId == view和resourceType == car
首先应用适用的
规则allowSameRegion {
允许
条件user.region == car.region
}
}

用户区域和汽车区域都保存在应用程序的数据库中。使用PIP或策略信息点读取值(详细信息,并且可以在此处观看教程


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?

解决方案

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.

这篇关于如何在企业应用程序中使用XACML处理深层粒度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆