如何评估XACML 2.0中的多值属性?我有以下XACML 2.0策略和请求。如果用户是超级管理员,则获得许可。在同一subject-attribute中具有<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>
根据设计,在XACML中,属性始终被视为多值。它们就是我们所说的袋子。属性值没有订单。这意味着:
是属性角色的所有有效值。请注意,即使单值属性仍然是一包值。实施例2和3是相同的给定顺序在袋中无关紧要。最后,价值可以在一个袋子里重复。我不能想出一个很好的理由,但技术上却可以(如例4)。
如果由于某种原因,您使用的PDP仅考虑第一个值,那么它的实现中存在一个主要错误。