2014-05-16 2 views
0

내 xacml 요청에는 정책 조건의 일부로 비교할 두 가지 특성이 포함되어 있습니다.XACML은 두 가지 요청 속성을 비교합니다.

는 그들은 : 나는 하드 코딩 된의 AttributeValue에 하나 개의 요청 속성 (즉 ResourceAttributeDesignator)를 비교 발견했습니다

urn:oasis:names:tc:xacml:1.0:subject:group-id 
urn:oasis:names:tc:xacml:1.0:resource:resource-id 

모든 정책의 예.

해당 group-id와 resource-id를 어떻게 비교합니까?

답변

1

XACML 조건을 사용해야합니다. 정책 세트, 정책 및 규칙에는 모두 속성을 값과 비교하는 데 사용할 수있는 XACML 대상이 있습니다. role=='manager'. 또한 규칙에는 두 속성을 비교하는 등 고급 비교를 수행 할 수있는 XACML 조건 요소가 있습니다.

다음
namespace stackoverflow{ 

    attribute groupId{ 
     category = subjectCat 
     id = "urn:oasis:names:tc:xacml:1.0:subject:group-id" 
     type = string 
    } 

    attribute resourceId{ 
     category = resourceCat 
     id = "urn:oasis:names:tc:xacml:1.0:resource:resource-id" 
     type = string 
    } 

    policy example{ 

     apply firstApplicable 
     rule checkGroup{ 
      condition groupId==resourceId 
      permit 
     } 
    } 
} 

는 XACML 3.0의 출력 :

<?xml version="1.0" encoding="UTF-8"?> 
<!--This file was generated by the ALFA Plugin for Eclipse from Axiomatics AB (http://www.axiomatics.com). 
Any modification to this file will be lost upon recompilation of the source ALFA file--> 
<xacml3:Policy xmlns:xacml3="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" 
    PolicyId="http://axiomatics.com/alfa/identifier/stackoverflow.example" 
    RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:first-applicable" 
    Version="1.0"> 
    <xacml3:Description /> 
    <xacml3:PolicyDefaults> 
     <xacml3:XPathVersion>http://www.w3.org/TR/1999/REC-xpath-19991116</xacml3:XPathVersion> 
    </xacml3:PolicyDefaults> 
    <xacml3:Target /> 
    <xacml3:Rule 
      Effect="Permit" 
      RuleId="http://axiomatics.com/alfa/identifier/stackoverflow.example.checkGroup"> 
     <xacml3:Description /> 
     <xacml3:Target /> 
     <xacml3:Condition> 
      <xacml3:Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:any-of-any"> 
       <xacml3:Function FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal"/> 
       <xacml3:AttributeDesignator 
        AttributeId="urn:oasis:names:tc:xacml:1.0:subject:group-id" 
        DataType="http://www.w3.org/2001/XMLSchema#string" 
        Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" 
        MustBePresent="false" 
       /> 
       <xacml3:AttributeDesignator 
        AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" 
        DataType="http://www.w3.org/2001/XMLSchema#string" 
        Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" 
        MustBePresent="false" 
       /> 
      </xacml3:Apply> 
     </xacml3:Condition> 
    </xacml3:Rule> 
</xacml3:Policy> 

당신은 ALFA 플러그인 here을 다운로드 할 수 있습니다 여기에

는 예 (알파 표기법을 사용하여)입니다.

관련 문제