2015-08-03 21 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條規則。