XACML - могут ли Условие и Цель сосуществовать в одном правиле?

Я хотел бы знать, если под XACML V.3 шанс сосуществовать <Condition> а также <Target> раздел размещен внутри того же правила. Похоже, что валидация схемы XLS отвергает такую ​​конструкцию. Может ли эта ошибка быть объяснена последовательностью операторов, или такая конструкция просто не предусмотрена и не возможна?

1 ответ

После тщательного изучения нескольких блогов, а также рассмотрения конструкции моего исходного кода XACML я смог объединить операторы и в одно правило. Я обнаружил, что всегда должен предшествовать операторам . Смотрите пример политики ниже:

<xacml3:Policy xmlns:xacml3="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17"  PolicyId="TestCityCountry" Version="1.0" RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides">
   <xacml3:PolicyDefaults>
      <xacml3:XPathVersion>http://www.w3.org/TR/1999/REC-xpath-19991116</xacml3:XPathVersion>
   </xacml3:PolicyDefaults>
   <xacml3:Target></xacml3:Target>
   <!--deny all other conditions-->
      <xacml3:Rule Effect="Deny" RuleId="Deny-Rule2"></xacml3:Rule>
      <xacml3:Rule RuleId="Permit-Rule1" Effect="Permit">
         <xacml3:Target>
            <xacml3:AnyOf>
               <xacml3:AllOf>
                  <xacml3:Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
                     <xacml3:AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">631</xacml3:AttributeValue>
                     <xacml3:AttributeDesignator AttributeId="http://w3.red.com/subject/employeeCountryCode" Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true"></xacml3:AttributeDesignator>
                  </xacml3:Match>
               </xacml3:AllOf>
            </xacml3:AnyOf>
            <xacml3:AnyOf>
               <xacml3:AllOf>
                  <xacml3:Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
                     <xacml3:AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">ldap</xacml3:AttributeValue>
                     <xacml3:AttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true"></xacml3:AttributeDesignator>
                  </xacml3:Match>
               </xacml3:AllOf>
            </xacml3:AnyOf>
            <xacml3:AnyOf>
               <xacml3:AllOf>
                  <xacml3:Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
                     <xacml3:AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">read</xacml3:AttributeValue>
                     <xacml3: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"></xacml3:AttributeDesignator>
                  </xacml3:Match>
               </xacml3:AllOf>
            </xacml3:AnyOf>
         </xacml3:Target>
         <xacml3:Condition>
            <xacml3:Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-at-least-one-member-of">
               <xacml3: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"></xacml3:AttributeDesignator>
               <xacml3:Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-bag">
                  <xacml3:AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Brasilia</xacml3:AttributeValue>
                  <xacml3:AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Curitiba</xacml3:AttributeValue>
                  <xacml3:AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Bahia</xacml3:AttributeValue>
                  <xacml3:AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Porto Alegre</xacml3:AttributeValue>
                  <xacml3:AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Rio de Janeiro</xacml3:AttributeValue>
                  <xacml3:AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">São Paulo</xacml3:AttributeValue>
               </xacml3:Apply>
            </xacml3:Apply>
         </xacml3:Condition>
         <xacml3:ObligationExpressions>
            <xacml3:ObligationExpression FulfillOn="Permit" ObligationId="citycountrycheck">
               <xacml3:AttributeAssignmentExpression AttributeId="urn:oasis:names:tc:xacml:3.0:example:attribute:text">
                  <xacml3:AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Rule 1: The city and country validation passed successfully</xacml3:AttributeValue>
               </xacml3:AttributeAssignmentExpression>
            </xacml3:ObligationExpression>
         </xacml3:ObligationExpressions>
         <xacml3:AdviceExpressions>
            <xacml3:AdviceExpression AdviceId="city-country-validated" AppliesTo="Permit">
               <xacml3:AttributeAssignmentExpression AttributeId="city-country-validated">
                  <xacml3:AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">CityCountryValidated</xacml3:AttributeValue>
               </xacml3:AttributeAssignmentExpression>
            </xacml3:AdviceExpression>
         </xacml3:AdviceExpressions>
      </xacml3:Rule>
      <xacml3:ObligationExpressions>
         <xacml3:ObligationExpression FulfillOn="Permit" ObligationId="allchecks">
            <xacml3:AttributeAssignmentExpression AttributeId="urn:oasis:names:tc:xacml:3.0:example:attribute:text">
               <xacml3:AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">The overall validation passed successfully</xacml3:AttributeValue>
            </xacml3:AttributeAssignmentExpression>
         </xacml3:ObligationExpression>
      </xacml3:ObligationExpressions>
   </xacml3:Policy> 
Другие вопросы по тегам