我是XACML新手,正在使用ALFA编写策略。我想写的政策是在一家银行设定2000美元的转账限额。如果要转移的金额大于该数额,则应拒绝该操作。
我该怎么做?
谢谢!
发布于 2014-10-09 06:53:51
您所拥有的用例非常简单。我建议你先用英语写,然后用阿尔法写:
type==bank account资源上执行type==bank account当且仅当amount transferred < the amount limit (例如,2000年) ==> 允许在阿尔法,上述政策成为
namespace policies{
attribute actionId{
category = actionCat
id = "actionId"
type = string
}
attribute resourceType{
category = resourceCat
id = "resourceType"
type = string
}
attribute amount{
category = resourceCat
id = "amount"
type = double
}
/**
* The limit could be a subject attribute in the case it's user-specific
*/
attribute limit{
category = subjectCat
id = "limit"
type = double
}
/*
* A user can do the `action==transfer` on a resource of `type==bank account` if and only if the `amount transferred
* < the amount limit` (e.g. 2000 in your case) ==> **permit**
*
*/
policy transfer{
target clause actionId == "transfer" and resourceType=="bank account"
apply firstApplicable
rule allow{
condition amount <= limit
permit
}
rule denyTransfer{
deny
}
}
}https://stackoverflow.com/questions/26268648
复制相似问题