2014-03-10 4 views
0

Я следовал за link, чтобы запустить pdp, используя конверт SAML на XACML. Затем я создал webservice (pdp и pdpclient - другими словами, XACML Request Generator). Здесь каждая вещь выполняется нормально, то есть генерирует запрос и получает результат с заданными (политики тестирования, заданные следующими link) политиками.Ошибка оценки политики XACML

Теперь я тестирую pdp с моими правилами! Но (с моей точки зрения) pdp неправильно оценивает политики. Для примера здесь моя политика

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
<Policy xmlns="urn:oasis:names:tc:xacml:2.0:policy:schema:os" 
    PolicyId="ServerDataDeletion" Version="2.0" 
    RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:deny-overrides"> 
    <Description>Server Data Deletion by Student</Description> 
    <Target> 
     <Subjects> 
      <Subject> 
       <SubjectMatch MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal"> 
        <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Visitor</AttributeValue> 
        <SubjectAttributeDesignator 
         AttributeId="urn:oasis:names:tc:xacml:1.0:subject:outside-university" 
         DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true" /> 
       </SubjectMatch> 
      </Subject> 
     </Subjects> 
     <Resources> 
      <Resource> 
       <ResourceMatch MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal"> 
        <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Server File</AttributeValue> 
        <ResourceAttributeDesignator 
         AttributeId="urn:oasis:names:tc:xacml:1.0:resource:file123" 
         DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true" /> 
       </ResourceMatch> 
      </Resource> 
     </Resources> 
     <Actions> 
      <Action> 
       <ActionMatch MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal"> 
        <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Delete</AttributeValue> 
        <ActionAttributeDesignator 
         AttributeId="urn:oasis:names:tc:xacml:1.0:action:delete123" 
         DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true" /> 
       </ActionMatch> 
      </Action> 
     </Actions> 
    </Target> 
    <Rule RuleId="ServerDataDeletion" Effect="Permit"> 
     <Description>Server Data Deletion</Description> 
     <Target> 
      <Subjects> 
       <Subject> 
        <SubjectMatch MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal"> 
         <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Student</AttributeValue> 
         <SubjectAttributeDesignator 
          AttributeId="urn:oasis:names:tc:xacml:1.0:subject:inside-university123" 
          DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true" /> 
        </SubjectMatch> 
       </Subject> 
      </Subjects> 
      <Resources> 
       <Resource> 
        <ResourceMatch MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal"> 
         <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Server File</AttributeValue> 
         <ResourceAttributeDesignator 
          AttributeId="urn:oasis:names:tc:xacml:1.0:resource:file" 
          DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false" /> 
        </ResourceMatch> 
       </Resource> 
      </Resources> 
      <Actions> 
       <Action> 
        <ActionMatch MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal"> 
         <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Delete</AttributeValue> 
         <ActionAttributeDesignator 
          AttributeId="urn:oasis:names:tc:xacml:1.0:action:delete" 
          DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false" /> 
        </ActionMatch> 
       </Action> 
      </Actions> 
     </Target> 
    </Rule> 
    <Rule RuleId="Default" Effect="Deny" /> 
</Policy> 

А вот мой запрос

Предметно-Id: урна: оазис: имена: дц: XACML: 1,0: Тема: вне-университет, Предметно-Value : Персонал

Arttibute-Id: урны: оазисы: имена: дц: XACML: 1.0: ресурс: file123, значение атрибута: Сервер Файл

Action-Id: урны: оазисы: имена: TC: XACML: 1,0: Действие: delete123, Action-Value: Удалить

И ответ я получаю это Запретить. Как видите, MustBePresent = true в теме, ресурсе и действии Policy-Target и Request не содержит Id. Согласно XACML 2.0, если MustBePresent является истинным, а идентификаторы НЕ присутствуют в запросе, тогда цель будет неопределенной. И если цель является целевой политикой, тогда вся политика будет неопределенной. Но в этом случае после неопределенной цели политики PDP все еще оценивает правило и делает результат в соответствии с алгоритмом объединения правил.

Дайте мне знать, если я ошибаюсь.

+0

Вы внедряете свой собственный PDP? Вы используете Sun XACML? –

+0

Я использую реализацию JBoss PDP. – Junaid

ответ

0

На самом деле, при быстром взгляде вы должны получать NotApplicable.

Вы имеете следующую структуру:

  • политики
    • Правило 1: дает ServerDataDeletion Разрешение
    • Правило 2: По умолчанию выходы Запретить.

Ваша политика имеет цель следующим образом:

<Target> 
    <Subjects> 
     <Subject> 
      <SubjectMatch MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal"> 
       <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Visitor</AttributeValue> 
       <SubjectAttributeDesignator 
        AttributeId="urn:oasis:names:tc:xacml:1.0:subject:outside-university" 
        DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true" /> 
      </SubjectMatch> 
     </Subject> 
    </Subjects> 
    <Resources> 
     <Resource> 
      <ResourceMatch MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal"> 
       <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Server File</AttributeValue> 
       <ResourceAttributeDesignator 
        AttributeId="urn:oasis:names:tc:xacml:1.0:resource:file123" 
        DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true" /> 
      </ResourceMatch> 
     </Resource> 
    </Resources> 
    <Actions> 
     <Action> 
      <ActionMatch MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal"> 
       <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Delete</AttributeValue> 
       <ActionAttributeDesignator 
        AttributeId="urn:oasis:names:tc:xacml:1.0:action:delete123" 
        DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true" /> 
      </ActionMatch> 
     </Action> 
    </Actions> 
</Target> 

Это будет применяться только, если вы являетесь Visitor пытается DeleteServer File.

По вашему запросу вы отправляете Staff вместо Visitor. Поэтому вы должны получить NotApplicable.

Если у вас есть шанс, перейдите к XACML 3.0. Зайдите в ALFA plugin for Eclipse, чтобы легко писать свои политики.

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