我使用Axiomatics策略服务器尝试了您的策略,我相信我可能已经找到了您问题的根本原因。您的某些属性标记为
MustBePresent
. 这是一个可选标志,如果设置为true,则如果属性没有值,则会使计算返回不确定。
访问审查
以下是授予访问权限的三种不同方式:
-
stringAtLeastOneMemberOf(stringBag("private/support" , "private/team") , Attributes.resource.resource_id ) AND "access" == Attributes.action.action_id AND "Employee" == http://test.org/claim/role
-
"Manager" == http://wso2.org/claims/role AND stringAtLeastOneMemberOf(stringBag("private/support" , "private/team") , Attributes.resource.resource_id ) AND "access" == Attributes.action.action_id
-
"Manager" == http://wso2.org/claims/role AND "access" == Attributes.action.action_id AND stringAtLeastOneMemberOf(stringBag("private" , "private/business" , "private/leadership") , Attributes.resource.resource_id )
ALFA
,授权的缩写语言。
政策审查
这是您的策略在策略编辑器中的外观。
顺便说一句,你的政策中有几件奇怪的事情:
-
您使用了两个相似但不同的属性标识符(
http://wso2.org/claims/role
和
http://test.org/claim/role
). 这是故意的吗?
-
-
我不确定是否需要将属性标记为
必须在场
. 我通常不会,但这可能是一种偏好。
-
当一个简单的目标可以实现时,您可以使用条件
之前
之后
以下内容比前者更容易阅读。
样本请求/响应
以下示例利用了XACML的JSON配置文件(
Wikipedia
|
Blog post
)
{
"Request": {
"AccessSubject": {
"Attribute": [
{
"AttributeId": "http://test.org/claim/role",
"Value": "Employee"
}
]
},
"Resource": {
"Attribute": [
{
"AttributeId": "urn:oasis:names:tc:xacml:1.0:resource:resource-id",
"Value": "private/support"
}
]
},
"Action": {
"Attribute": [
{
"AttributeId": "urn:oasis:names:tc:xacml:1.0:action:action-id",
"Value": "access"
}
]
},
"Environment": {
"Attribute": []
}
}
}
和匹配的响应
{
"Response" : {
"Decision" : "Permit",
"Status" : {
"StatusCode" : {
"Value" : "urn:oasis:names:tc:xacml:1.0:status:ok",
"StatusCode" : {
"Value" : "urn:oasis:names:tc:xacml:1.0:status:ok"
}
}
}
}
}