【问题标题】:Evaluating multi-valued Attribute in XACML 2.0 policy在 XACML 2.0 策略中评估多值属性
【发布时间】:2019-08-11 04:41:57
【问题描述】:

如何评估 XACML 2.0 中的多值属性?我有以下 XACML 2.0 政策和要求。如果用户具有超级管理员的角色,他将获得许可。在同一主题属性中具有多个角色作为<AttributeValue> 元素,仅检索第一个<AttributeValue> 元素进行评估。如何获取和检查我的策略中的所有这些值?

政策

<Policy xmlns="urn:oasis:names:tc:xacml:2.0:policy:schema:os"  PolicyId="a-user-role-policy" RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:first-applicable">
   <Description>Sample XACML Authorization Policy</Description>
   <Target></Target>
   <Rule Effect="Permit" RuleId="primary-group-rule">
      <Target>
         <Actions>
            <Action>
               <ActionMatch MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
                  <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">read</AttributeValue>
                  <ActionAttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" DataType="http://www.w3.org/2001/XMLSchema#string"></ActionAttributeDesignator>
               </ActionMatch>
            </Action>
         </Actions>
      </Target>
      <Condition>
         <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:any-of">
            <Function FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal"></Function>
            <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">super-admin</AttributeValue>
            <SubjectAttributeDesignator AttributeId="group" DataType="http://www.w3.org/2001/XMLSchema#string"></SubjectAttributeDesignator>
         </Apply>
      </Condition>
   </Rule>
   <Rule Effect="Deny" RuleId="deny-rule"></Rule>
</Policy>

请求

<Request xmlns="urn:oasis:names:tc:xacml:2.0:context:schema:os"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Subject>
        <Attribute AttributeId="group"
            DataType="http://www.w3.org/2001/XMLSchema#string">
            <AttributeValue>admin</AttributeValue>
            <AttributeValue>super-admin</AttributeValue>
        </Attribute>
    </Subject>
    <Resource>
        <Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id"
            DataType="http://www.w3.org/2001/XMLSchema#string">
            <AttributeValue>http://localhost:8280/services/echo/</AttributeValue>
        </Attribute>
    </Resource>
    <Action>
        <Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id"
            DataType="http://www.w3.org/2001/XMLSchema#string">
            <AttributeValue>read</AttributeValue>
        </Attribute>
    </Action>
    <Environment />
</Request>

【问题讨论】:

  • 你用的是什么引擎?
  • 你应该切换到 AuthZForce(开源)或 Axiomatics(商业)
  • 我正在使用 WSO2 身份服务器 5.4.1。
  • 嗯,他们应该没问题,现在也在 XACML 3.0 上
  • 它工作正常,当我将 列表拆分为单独的 元素时,每个元素都有一个

标签: authorization access-control xacml abac xacml2


【解决方案1】:

按照设计,在 XACML 中,属性始终被认为是多值的。它们就是我们所说的包。属性值没有顺序。这意味着:

  • 示例 1:角色 = ["manager"]
  • 示例 2:角色 = ["manager" , "janitor"]
  • 示例 3:角色 = ["janitor", "manager"]
  • 示例 4:角色 = ["janitor", "manager", "manager"]

都是属性角色的有效值。请注意,即使是单值属性仍然是一组值。示例 2 和 3 是相同的给定顺序在袋子中无关紧要。最后,值可以在包中重复。我想不出一个很好的理由,但从技术上讲,他们可以(如示例 4 所示)。

如果出于某种原因,您使用的 PDP 仅考虑第一个值,那么它的实现中存在重大错误。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-20
    • 1970-01-01
    • 1970-01-01
    • 2022-10-14
    相关资源
    最近更新 更多