xacml - XACML 阅读资源
问题描述
我正在尝试制定一个规则,该规则仅在为每个用户读取操作时才允许访问任何资源。我怀疑我是否需要在这里放置像任何用户这样的东西
<Rule Effect="Permit" RuleId="Rule Permit #1">
<Target>
<AnyOf>
<AllOf>
<Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-regexp-match">
<AttributeValue
DataType="http://www.w3.org/2001/XMLSchema#string">any
</AttributeValue>
<AttributeDesignator
AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id"
Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource"
DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true">
</AttributeDesignator>
</Match>
然后动作
<Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
<AttributeValue
DataType="http://www.w3.org/2001/XMLSchema#string">read
</AttributeValue>
<AttributeDesignator
AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id"
Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action"
DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true"></AttributeDesignator>
</Match>
或者我可以删除第一部分并直接执行操作,因为资源是任意的。
谢谢!!
解决方案
您只需要匹配操作:
<Rule Effect="Permit" RuleId="Rule Permit #1">
<Target>
<AnyOf>
<AllOf>
<Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
<AttributeValue
DataType="http://www.w3.org/2001/XMLSchema#string">read</AttributeValue>
<AttributeDesignator
AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id"
Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action"
DataType="http://www.w3.org/2001/XMLSchema#string"
MustBePresent="true" />
</Match>
</AllOf>
</AnyOf>
</Target>
</Rule>
在这种情况下,当且仅当 action-id 等于“读取”时,规则评估为 Permit,而不管用户或资源属性如何,换句话说:对于任何用户或资源。请注意,最终决定取决于封闭策略上的规则组合算法(如果有,可能还有 PolicySet 上的策略组合算法)。如果你得到不同的东西,那就是 XACML 实现的问题。
推荐阅读
- python - 我是 python 新手,对编码知之甚少,但想了解更多关于如何创建工作代码的信息
- elasticsearch - 如何在logstash中合并两个文档
- javascript - React Admin:创建/编辑视图中的动态成功消息
- android-studio - Android studio AAPT:写入 R.txt 失败:数据无效
- java - 多对一连接的多个 sql 查询与来自 java 应用程序的单个查询
- python - Savedmodel 的预测(Tensorflow 2)
- python - Pandas 如何将数据框中的所有值保存到 csv 中?
- php - 使用 Dom 查找脚本变量的值
- c++ - 在两个结构之间共享一个数组
- python - 带有许多空格的不和谐用户名 + 带有更多参数的命令