简体   繁体   English

如何在企业应用中用XACML处理深层次粒化

[英]How to deal with deep level granularization with XACML in enterprise application

I am using IS WSO2 for authorization with XACML. 我使用IS WSO2进行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? 示例:如果我有像getCarDetails(Object User)这样的方法,我应该只获得分配给该特定用户的那些汽车,那么如何使用XACMl进行处理?

Wso2 provides support for PIP where we can use custom classes which can fetch data from database. Wso2为PIP提供支持,我们可以使用可以从数据库中获取数据的自定义类。 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. 但我不确定我们是应该在PDP端复制原始数据库还是将原始数据库提供给PIP以获取实时数据的更新。

Because Cars would be dynamic for the application eg. 因为汽车对于应用来说是动态的,例如。 currently 10 cars assigned to user Alice. 目前有10辆汽车分配给用户Alice。 suddenly supervisor add 20 more car in his list which will be in application level database. 突然主管在他的列表中添加了20多辆汽车,这将在应用程序级数据库中。 Then how these other 20 cars will be automatically assigned in policy at PDP level until it also have this latest information. 那么这些其他20辆汽车将如何在PDP级别的政策中自动分配,直到它还拥有最新信息。

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? 但我不知道如何处理这个问题,因为在整个应用程序中我们可以有很多这种复杂的场景,有时我们会从4个或5个表中获取一个用户的数据,然后如何处理这个场景?

Your question is a great and the answer will highlight the key benefits of XACML and externalized authorization as a whole. 您的问题很棒,答案将突出XACML和外部授权的主要优势。

In XACML, you define generic, global rules, about what is allowed and what isn't using what I would call high-level attributes eg attributes of the vehicle (in your case) or the user (role, department, ...) 在XACML中,您定义了通用的全局规则,关于允许什么以及什么不使用我称之为高级属性的内容,例如车辆的属性(在您的情况下)或用户(角色,部门......)

For instance a simple rule could be (using the ALFA syntax): 例如,一个简单的规则可能是(使用ALFA语法):

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 ). 使用PIP或策略信息点( 此处详细信息)读取值。

In your example, you talk about direct assignment, ie 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. 这意味着分配的用户信息必须保存在应用程序数据库,CSV文件,Web服务或其他信息源中。 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. XACML规则本身不会改变。 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. 如果主管在员工列表中添加20多辆汽车(在应用程序级数据库中维护),则PDP将能够通过PIP使用该信息,并相应地授予或拒绝访问。

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). XACML的主要优点是你可以添加第二条规则,说明主管可以看到他/她被分配到的汽车(正常规则)以及分配给他/她的下属的汽车(一个新的代理委托人)规则)。

This diagram, taken from the Axiomatics blog, summarizes the XACML flow: 此图取自Axiomatics博客,总结了XACML流程:

XACML架构 -  Axiomatics

HTH, let me know if you have further questions. HTH,如果您有其他问题,请与我们联系。 You can download ALFA here and you can watch tutorials here . 你可以在这里下载ALFA ,你可以在这里观看教程

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM