我遵循链接在XACML上使用SAML信封运行pdp。然后我创建了webservice ( pdp和pdpclient -换句话说,XACML请求生成器)。在这里,每件事情都运行得很好,即生成请求,并在给定的(由后续的链接提供的测试策略)中获得完美的结果。
现在我用我的政策来测试pdp !!但是(在我看来) pdp没有正确地评估策略。例如,这是我的政策
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Policy xmlns="urn:oasis:names:tc:xacml:2.0:policy:schema:os"
PolicyId="ServerDataDeletion" Version="2.0"
RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:deny-overrides">
<Description>Server Data Deletion by Student</Description>
<Target>
<Subjects>
<Subject>
<SubjectMatch MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Visitor</AttributeValue>
<SubjectAttributeDesignator
AttributeId="urn:oasis:names:tc:xacml:1.0:subject:outside-university"
DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true" />
</SubjectMatch>
</Subject>
</Subjects>
<Resources>
<Resource>
<ResourceMatch MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Server File</AttributeValue>
<ResourceAttributeDesignator
AttributeId="urn:oasis:names:tc:xacml:1.0:resource:file123"
DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true" />
</ResourceMatch>
</Resource>
</Resources>
<Actions>
<Action>
<ActionMatch MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Delete</AttributeValue>
<ActionAttributeDesignator
AttributeId="urn:oasis:names:tc:xacml:1.0:action:delete123"
DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true" />
</ActionMatch>
</Action>
</Actions>
</Target>
<Rule RuleId="ServerDataDeletion" Effect="Permit">
<Description>Server Data Deletion</Description>
<Target>
<Subjects>
<Subject>
<SubjectMatch MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Student</AttributeValue>
<SubjectAttributeDesignator
AttributeId="urn:oasis:names:tc:xacml:1.0:subject:inside-university123"
DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true" />
</SubjectMatch>
</Subject>
</Subjects>
<Resources>
<Resource>
<ResourceMatch MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Server File</AttributeValue>
<ResourceAttributeDesignator
AttributeId="urn:oasis:names:tc:xacml:1.0:resource:file"
DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false" />
</ResourceMatch>
</Resource>
</Resources>
<Actions>
<Action>
<ActionMatch MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Delete</AttributeValue>
<ActionAttributeDesignator
AttributeId="urn:oasis:names:tc:xacml:1.0:action:delete"
DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false" />
</ActionMatch>
</Action>
</Actions>
</Target>
</Rule>
<Rule RuleId="Default" Effect="Deny" />
</Policy>这是我的要求
主题-Id: urn:oasis:names:tc:xacml:1.0:subject:outside-university,主题-值:员工 Arttibute-Id: urn:oasis:names:tc:xacml:1.0:resource:file123,属性值:服务器文件 操作-Id: urn:oasis:names:tc:xacml:1.0:action:delete123,操作-值:删除
我得到的回应是Deny。正如您所看到的,MustBePresent = true在Subject,和Request中没有包含任何Id。根据XACML2.0,如果MustBePresent是真的,并且请求中没有ID,那么目标将是不确定的。如果目标是策略目标,那么整个策略将是不确定的。但是在这种情况下,在不确定的策略-目标之后,PDP仍然按照规则合并算法对规则和生成结果进行评估。
如果我错了请告诉我。
发布于 2014-05-16 21:19:25
实际上,快速地看一下,您应该会得到NotApplicable。
您的结构如下:
您的策略的目标如下:
<Target>
<Subjects>
<Subject>
<SubjectMatch MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Visitor</AttributeValue>
<SubjectAttributeDesignator
AttributeId="urn:oasis:names:tc:xacml:1.0:subject:outside-university"
DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true" />
</SubjectMatch>
</Subject>
</Subjects>
<Resources>
<Resource>
<ResourceMatch MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Server File</AttributeValue>
<ResourceAttributeDesignator
AttributeId="urn:oasis:names:tc:xacml:1.0:resource:file123"
DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true" />
</ResourceMatch>
</Resource>
</Resources>
<Actions>
<Action>
<ActionMatch MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Delete</AttributeValue>
<ActionAttributeDesignator
AttributeId="urn:oasis:names:tc:xacml:1.0:action:delete123"
DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true" />
</ActionMatch>
</Action>
</Actions>
</Target>只有当您是一个试图Visitor Delete Server File的Server File时,它才适用。
在您的请求中,您发送的是Staff而不是Visitor。因此,您应该得到NotApplicable。
如果有机会,请转到XACML3.0。查看面向Eclipse的ALFA插件,轻松编写您的策略。
https://stackoverflow.com/questions/22296036
复制相似问题