我正在尝试编写一个代码,将允许用户访问基于安全角色的网站内容。因此,一些用户可以看到所有内容,而一些用户只能看到带有特定扩展名的urls。
我的大部分代码都可以工作,但我在访问3个子类别时遇到了问题。
<Rule Effect="Permit" RuleId="accesses">
<Description>Permission for lower clearance</Description>
<Target>
<Resources>
<Resource>
<ResourceMatch
MatchId="urn:oasis:names:tc:xacml:1.0:function:regexp-string-match">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">home.html
</AttributeValue>
<ResourceAttributeDesignator
AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id"
DataType="http://www.w3.org/2001/XMLSchema#string" Issuer="policy-admin@website.com"
MustBePresent="true" />
</ResourceMatch>
</Resource>
<Resource>
<ResourceMatch
MatchId="urn:oasis:names:tc:xacml:1.0:function:regexp-string-match">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">localweather.html
</AttributeValue>
<ResourceAttributeDesignator
AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id"
DataType="http://www.w3.org/2001/XMLSchema#string" Issuer="policy-admin@website.com"
MustBePresent="true" />
</ResourceMatch>
</Resource>
<Resource>
<ResourceMatch
MatchId="urn:oasis:names:tc:xacml:1.0:function:regexp-string-match">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">about.html
</AttributeValue>
<ResourceAttributeDesignator
AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id"
DataType="http://www.w3.org/2001/XMLSchema#string" Issuer="policy-admin@website.com"
MustBePresent="true" />
</ResourceMatch>
</Resource>
</Resources>
</Target>
<Condition>
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:regexp-string-match">
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only">
<SubjectAttributeDesignator AttributeId="AccessLevel"
DataType="http://www.w3.org/2001/XMLSchema#string" Issuer="policy-admin@website.com"
MustBePresent="true" />
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Clear</AttributeValue>
</Apply>
</Apply>
</ Condition >
</Rule>我有这3个资源,当我运行这个程序时,我得到了一个“不确定”的响应。每条规则只能有一个资源吗?是否有其他东西抛出了异常?
发布于 2013-02-27 19:45:15
你可以在目标中拥有树资源。根据你的规则,他们将充当"OR“。请检查您的XACML请求,可能是您正在发送的请求与策略不匹配(策略有MustBePresent="true“表示,如果属性不在那里,PDP将创建一个不确定的错误)。请将它们更改为"false”并查看。
发布于 2013-07-26 20:37:09
这实际上是一个条件问题。这些资源都是叶级别的文件。我的策略没有正确的用户属性值。我将它与我的LDAP模式进行了比较,并使其正常工作。
https://stackoverflow.com/questions/15100111
复制相似问题