【发布时间】:2018-01-29 09:32:19
【问题描述】:
您好,我正在尝试使用 XACML3,我发现当请求与条件匹配时,我得到的响应是许可。但是当它不适用时,我不适用而不是否认。我不确定这种行为是否正确。
我明白我可以用 deny-unless-permit 组合算法掩盖不适用的响应,但我不明白这种行为。
以下是我的政策
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Policy xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" PolicyId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIA1:policy"
RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:deny-overrides"
Version="1.0">
<Target>
<AnyOf>
<AllOf>
<Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">MyApp</AttributeValue>
<AttributeDesignator
AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id"
DataType="http://www.w3.org/2001/XMLSchema#string"
Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource"
MustBePresent="true" />
</Match>
</AllOf>
</AnyOf>
</Target>
<Rule Effect="Permit"
RuleId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIA1:rule">
<Target />
<Condition>
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-equal">
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
<AttributeDesignator
AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:age"
Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject"
DataType="http://www.w3.org/2001/XMLSchema#integer" MustBePresent="false" />
</Apply>
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
<AttributeDesignator
AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:age2"
Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject"
DataType="http://www.w3.org/2001/XMLSchema#integer" MustBePresent="false" />
</Apply>
</Apply>
</Condition>
</Rule>
</Policy>
这是我的请求,但我得到了不适用的响应
<?xml version="1.0" encoding="utf-8"?>
<Request ReturnPolicyIdList="false" CombinedDecision="false" xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Attributes Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject">
<Attribute IncludeInResult="false" AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:age">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#integer">45</AttributeValue>
</Attribute>
<Attribute IncludeInResult="false" AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:age2">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#integer">4</AttributeValue>
</Attribute>
</Attributes>
<Attributes Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource">
<Attribute IncludeInResult="false" AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">MyApp</AttributeValue>
</Attribute>
</Attributes>
</Request>
仅当年龄和年龄 2 匹配时,我才获得许可响应,否则响应不适用。不适用意味着没有找到匹配规则,但目标确实与resource-id 字符串成功匹配,那么为什么响应不适用?任何帮助表示赞赏。
【问题讨论】: