Is it possible to compare attributes in a XACML policy?

ε祈祈猫儿з 提交于 2019-12-05 18:41:49

Yes of course, this is in fact one of the key benefits of XACML over other authorization frameworks and definitely over RBAC.

In XACML, there are 2 elements you can use to define the applicability of the authorization. These are:

  • XACML targets
    • targets exist in Policy Set elements, Policy elements, and Rule elements.
    • targets are for simple matching between an attribute and a value e.g. role=="manager"
  • XACML conditions: conditions exist in Rule elements only.
    • conditions are for any type of matching including the one you are looking for. With conditions, you can compare any number of attributes e.g. userDepartment==resourceDepartment.

I recommend you use ALFA to write your policies. It's much easier than plain old XACML. ALFA is a free tool developed by Axiomatics (disclaimer: I work for Axiomatics). It is also in the process of being standardized at the OASIS XACML Technical Committee.

I think there're 2 ways to do this:

  1. Define two "VariableDefinition"s in your policy: one to get the part before the underscore character, the other to get the the part between the last two slash character. [i wonder if XACML's core spec has defined such function] then you can use the two "VariableDefinition"s under the "Rule". then use a standart string-equal function to compare them.

  2. just define a new function of your own, and add that to your FunctionFactory that your PDP uses. These two approach is the same, your need to apply a specified funtion on some attribute instead of using the raw attributevalue directly.

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