2017-02-08 8 views
0

я создал две роли, на KeyRock, и для каждого из них у меня связаны различные разрешенияFIWARE AuthZForce не проверяет второе правило внутри той же PolicySet

User1-> Role1-> Perm1 (доступ в res1)

User2-> Role2-> Perm2 (доступ к res2)

После спасена, я вижу в файловой системе AuthZforce в новый домен, который имеет 3 политики.

Первая политика - cm9vdA /. Он имеет < PolicySet>, a < Политика> и < Правило Эффект = "Разрешить" RuleId = "разрешить все" /> Последняя политика имеет < PolicySet>, две политики <> и два правила (по одному для каждого разрешение) В pdp.xml домена содержится < policyRef>, целью которого является создание последней созданной политики (< policyRef> 331409a9-6014-4cfd-9180-f04bb22481f4 </policyRef>).

После этого файл политики xml.

<PolicySet xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" PolicySetId="331409a9-6014-4cfd-9180-f04bb22481f4" Version="1.0" PolicyCombiningAlgId="urn:oasis:names:tc:xacml:3.0:policy-combining-algorithm:deny-unless-permit"> 
<Description>Policy Set for application 3829292cdc25477dace68f376ef79d8b</Description> 
<Target/> 
<Policy PolicyId="" Version="1.0" RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:deny-unless-permit"> 
    <Description>Role 9d2ebfde53044d2a8c22df3fe753b630 from application 3829292cdc25477dace68f376ef79d8b</Description> 
    <Target> 
     <AnyOf> 
      <AllOf> 
       <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal"> 
        <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">3829292cdc25477dace68f376ef79d8b</AttributeValue> 
        <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true"/> 
       </Match> 
      </AllOf> 
     </AnyOf> 
    </Target> 
    <Rule RuleId="fe8f4ebb98054feeb26bfc01eb93cce1" Effect="Permit"> 
     <Description>res1</Description> 
     <Target> 
      <AnyOf> 
       <AllOf> 
        <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal"> 
         <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">res1</AttributeValue> 
         <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="urn:thales:xacml:2.0:resource:sub-resource-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true"/> 
        </Match> 
       </AllOf> 
      </AnyOf> 
      <AnyOf> 
       <AllOf> 
        <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal"> 
         <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">GET</AttributeValue> 
         <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action" AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true"/> 
        </Match> 
       </AllOf> 
      </AnyOf> 
     </Target> 
     <Condition> 
      <Apply FunctionId="urn:oasis:names:tc:xacml:3.0:function:any-of"> 
       <Function FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal"/> 
       <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">9d2ebfde53044d2a8c22df3fe753b630</AttributeValue> 
       <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="urn:oasis:names:tc:xacml:2.0:subject:role" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/> 
      </Apply> 
     </Condition> 
    </Rule> 
</Policy> 
<Policy PolicyId="" Version="1.0" RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:deny-unless-permit"> 
    <Description>Role 729019b1a9d44380b8b74dc788053dde from application 3829292cdc25477dace68f376ef79d8b</Description> 
    <Target> 
     <AnyOf> 
      <AllOf> 
       <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal"> 
        <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">3829292cdc25477dace68f376ef79d8b</AttributeValue> 
        <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true"/> 
       </Match> 
      </AllOf> 
     </AnyOf> 
    </Target> 
    <Rule RuleId="1d9bce94aaf04127b7ec8cfc63d17622" Effect="Permit"> 
     <Description>res2</Description> 
     <Target> 
      <AnyOf> 
       <AllOf> 
        <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal"> 
         <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">res2</AttributeValue> 
         <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="urn:thales:xacml:2.0:resource:sub-resource-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true"/> 
        </Match> 
       </AllOf> 
      </AnyOf> 
      <AnyOf> 
       <AllOf> 
        <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal"> 
         <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">GET</AttributeValue> 
         <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action" AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true"/> 
        </Match> 
       </AllOf> 
      </AnyOf> 
     </Target> 
     <Condition> 
      <Apply FunctionId="urn:oasis:names:tc:xacml:3.0:function:any-of"> 
       <Function FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal"/> 
       <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">729019b1a9d44380b8b74dc788053dde</AttributeValue> 
       <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="urn:oasis:names:tc:xacml:2.0:subject:role" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/> 
      </Apply> 
     </Condition> 
    </Rule> 
</Policy> 

Когда User1 пытается получить доступ (по Вильма Пеп Proxy) в res1, согласование верно, то условие выполнено, и решение «Разрешить».

Если пользователь1 пытается получить доступ к res2 ... Решение «Отклонить».

Но ....

Когда Пользователь2 пытается получить доступ (по Вильма Пеп Proxy) к res2 ... Решение является «Запретить».

Глядя на файл журнала AuthZforce, я вижу, что PolicySetId = "331409a9-6014-4cfd-9180-f04bb22481f4" правильно идентифицирован, но проверка останавливается до первого правила. Infact, он сравнивает запрошенный ресурс «res2» с «res1» и отрицает, потому что они не совпадают. Проверка не продолжает оценивать следующее правило, где есть «res2», и сравнение должно быть истинным.

В чем проблема?

Спасибо за сотрудничество.

ответ

Смежные вопросы