【问题标题】:Writing a sample ABAC authorization policy using ALFA and XACML使用 ALFA 和 XACML 编写示例 ABAC 授权策略
【发布时间】:2014-12-03 19:21:53
【问题描述】:

我是 XACML 的新手,正在使用 ALFA 编写策略。我要写的政策是在银行设置 2000 美元的转账限额。如果要转移的金额超过此金额,则应拒绝该操作。

我该怎么做?

谢谢!

【问题讨论】:

    标签: authorization access-control xacml alfa


    【解决方案1】:

    您的用例非常简单。我建议你先用英文写,然后再用 ALFA:

    • 当且仅当 amount transferred < the amount limit(例如,在您的情况下为 2000)==> permit
    • 时,用户才能对 type==bank account 的资源执行 action==transfer
    • 所有其他情况 ==> 拒绝

    在 ALFA 中,上述策略变为

    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
            }
         }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-25
      • 2018-11-02
      • 2017-02-05
      • 1970-01-01
      • 2023-03-12
      相关资源
      最近更新 更多