2015-08-03 89 views
0

很难解释WSO2 XACML标准编辑器制定的策略定义中的“Try It”结果数据。标准编辑器/任何调试功能的WSO2标识/ XACML评估是否可用?

有关XACML引擎和定义的处理问题:

  • 是否有一个调试支持可显示每个规则和语句评价部分结果 ?
  • 布尔逻辑是否适用于“或”,“和”组合?
  • 是否有可用于修改默认属性值(字符串)的工具,例如使用“当前时间”属性作为有效的环境设置?

策略(由标准编辑器输入的)

<Policy xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" PolicyId="TodaysPolicy1" RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides" Version="1.0"> 
    <Description>Standard Editor Doctor Rule      </Description> 
    <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">^(http:)</AttributeValue> 
       <AttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:environment:environment-id" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:environment" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true"/> 
      </Match> 
     </AllOf> 
     </AnyOf> 
    </Target> 
    <Rule Effect="Permit" RuleId="DoctorAdmin"> 
     <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">^(http:)</AttributeValue> 
        <AttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:environment:environment-id" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:environment" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true"/> 
       </Match> 
      </AllOf> 
     </AnyOf> 
     </Target> 
     <Condition> 
     <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:or"> 
      <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:and"> 
       <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal"> 
        <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only"> 
        <AttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id" Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true"/> 
        </Apply> 
        <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">admin</AttributeValue> 
       </Apply> 
       <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-at-least-one-member-of"> 
        <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-bag"> 
        <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">read</AttributeValue> 
        <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">write</AttributeValue> 
        <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">update</AttributeValue> 
        <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">delete</AttributeValue> 
        </Apply> 
        <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"/> 
       </Apply> 
       <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:not"> 
        <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:and"> 
        <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-greater-than"> 
         <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only"> 
          <AttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:environment:environment-id" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:environment" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true"/> 
         </Apply> 
         <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">07:00:00 05:00</AttributeValue> 
        </Apply> 
        <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-less-than"> 
         <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only"> 
          <AttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:environment:environment-id" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:environment" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true"/> 
         </Apply> 
         <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">20:00:00 05:00</AttributeValue> 
        </Apply> 
        </Apply> 
       </Apply> 
      </Apply> 
      <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal"> 
       <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only"> 
        <AttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id" Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true"/> 
       </Apply> 
       <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">doctor</AttributeValue> 
      </Apply> 
     </Apply> 
     </Condition> 
    </Rule> 
</Policy> 

请求(生成由尝试)

     <Request xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" CombinedDecision="false" ReturnPolicyIdList="false"> 
<Attributes Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action"> 
<Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" IncludeInResult="false"> 
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">read</AttributeValue> 
</Attribute> 
</Attributes> 
<Attributes Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject"> 
<Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id" IncludeInResult="false"> 
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">doctor</AttributeValue> 
</Attribute> 
</Attributes> 
<Attributes Category="urn:oasis:names:tc:xacml:3.0:attribute-category:environment"> 
<Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:environment:environment-id" IncludeInResult="false"> 
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">08:00:00 05:00</AttributeValue> 
</Attribute> 
</Attributes> 
<Attributes Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource"> 
<Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" IncludeInResult="false"> 
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">http://localhost:9444/medicalrecords</AttributeValue> 
</Attribute> 
</Attributes> 
</Request> 

经结果[试验评价]

     <Response xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17"> 
<Result> 
<Decision>NotApplicable</Decision> 
<Status> 
<StatusCode Value="urn:oasis:names:tc:xacml:1.0:status:ok"/> 
</Status> 
</Result> 
</Response> 

在此先感谢您的指导。

回答

0

WSO2中的调试功能确实缺失。我使用Axiomatics策略管理点及其ALFA插件编写并测试所有策略。

我在PAP中尝试过你的政策。这是在PAP内展开时的样子。

Exploring a policy with the Axiomatics Policy Administration Point

现在我检查你的XACML的要求了。

a XACML 3.0 request inside the Axiomatics PAP

还有一个重要原因,您的策略是行不通的。

  • 该策略需要一个资源ID,但您的请求在环境ID中发送。

这就是说,有你的政策的其他问题:

  • 首先你使用一个字符串,正则表达式匹配的资源ID,但实际上你应该使用字符串开始,用自你想要做的是检查字符串以http://开头。你也想让anyURI类型不是字符串。
  • 其次你做两次检查:一次在政策和一次在规则。一次就够了,不是两次。
  • 第三,您将主题ID与医生进行比较。医生是一个角色不是主题ID,因此创建一个属性为
  • 您使用environment-id传达当前时间,实际上在XACML中有一个属性称为urn:oasis:names:tc:xacml:1.0 :环境:当前时间。
  • 您使用条件来轻松表达目标。
  • 最后你在条件中加入了太多逻辑,例如4条不同的行动,你可以分为4条规则。