如何使用XACML中的义务跟踪属性的值

时间:2016-01-27 20:31:39

标签: authorization wso2is access-control xacml abac

想知道是否有办法加载之前由PIP扩展属性查找器加载的属性值并将其转移($myattr1)为义务,以便以明文形式获取打印输出消息,主要是有用的用于执行调试任务。

在我的XACML义务之下,我想添加到我的规则中(以抽象符号书写):

  <xacml2:Obligations>
    <xacml2:Obligation FulfillOn="Permit" ObligationId="debug1">
      $myattr1 = AttributeId="http://red.com/subject/groupsUserBelong"
      <xacml2:AttributeAssignment AttributeId="debug1" DataType="http://www.w3.org/2001/XMLSchema#string">Attribute found: $myattr1</xacml2:AttributeAssignment>
    </xacml2:Obligation>
  </xacml2:Obligations>

更新了代码段

下面您将找到一个示例,说明如何将文本消息与来自PIP查找的动态数据相结合,通过ObligationExpressions生成输出:

   <Rule Effect="Deny" RuleId="Deny-Rule1">
      <Target></Target>
      <Condition>
         <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:not">
            <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-is-in">
               <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">myGroup</AttributeValue>
               <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="http://red.com/subject/groupsUserBelong" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true"></AttributeDesignator>
            </Apply>
         </Apply>
      </Condition>
      <ObligationExpressions>
         <ObligationExpression FulfillOn="Deny" ObligationId="groupscheck">
            <AttributeAssignmentExpression AttributeId="urn:oasis:names:tc:xacml:3.0:example:attribute:text">
               <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Rule 1 - The groups validation error</AttributeValue>
            </AttributeAssignmentExpression>
         </ObligationExpression>
         <ObligationExpression ObligationId="debug1" FulfillOn="Deny"> 
            <AttributeAssignmentExpression AttributeId="debug1">
            <AttributeDesignator AttributeId="http://red.com/subject/groupsUserBelong" Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/> 
            </AttributeAssignmentExpression> 
         </ObligationExpression> 
      </ObligationExpressions>
   </Rule>

1 个答案:

答案 0 :(得分:0)

不,这在WSO2 IS和XACML 2.0中是不可能的。为此,您需要使用XACML 3.0。在XACML 3.0中添加了在义务中添加变量的能力(它们在XACML规范中称为属性赋值)。

Axiomatics Policy Server支持这一点。正如您所指出的,它是一个用于调试目的的简洁功能,但也适用于其他情况,例如。

  • 拒绝用户自行转账的权利+通知其经理的义务。

在此示例中,义务将包含经理的电子邮件。以下是使用语法的示例。

    policy transferMoney{
        target clause actionId == "transfer"
        apply firstApplicable
        rule denySelfTransfer{
            condition requestor==recipient
            deny
            on deny {
                obligation notifyManager{
                    message = "An employee tried to transfer money to themselves"
                    employee = employeeId
                    email = managerEmail
                }
            }
        }
    }