2014-12-08 5 views
0

XACML 정책을 개발 중이며 sun.xacml 라이브러리를 사용하고 있습니다. 두 속성을 비교하고 싶습니다. 하나는 주제에 대한 것이고 다른 하나는 자원에 대한 액세스 허용입니다.XACML 정책의 속성 비교

나는이 XACML 파일

<?xml version="1.0"?> 
 
<Policy PolicyId="GeneratedPolicy" RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:permit-overrides"> 
 
    <Description>Policy che permette la lettura del file ai client che hanno un livello di permesso maggiore o uguale al livello di permesso del file richiesto</Description> 
 
    <Target> 
 
<Subjects> 
 
    <AnySubject/> 
 
</Subjects> 
 
<Resources> 
 
    <AnyResource/> 
 
</Resources> 
 
<Actions> 
 
    <Action> 
 
\t <ActionMatch MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal"> 
 
\t <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">read</AttributeValue> 
 
\t <ActionAttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" DataType="http://www.w3.org/2001/XMLSchema#string"/> 
 
\t </ActionMatch> 
 
    </Action> 
 
</Actions> 
 
    </Target> 
 
    <Rule RuleId="canRead" Effect="Permit"> 
 
<Target> 
 
    <Subjects> 
 
\t <AnySubject/> 
 
    </Subjects> 
 
    <Resources> 
 
\t <AnyResource/> 
 
    </Resources> 
 
    <Actions> 
 
\t <Action> 
 
\t <ActionMatch MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal"> 
 
\t \t <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">read</AttributeValue> 
 
\t \t <ActionAttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" DataType="http://www.w3.org/2001/XMLSchema#string"/> 
 
\t </ActionMatch> 
 
\t </Action> 
 
    </Actions> 
 
</Target> 
 
<Condition FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-greater-than-or-equal"> 
 
    <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only"> 
 
\t <SubjectAttributeDesignator AttributeId="level-permission" DataType="http://www.w3.org/2001/XMLSchema#string"/> 
 
    </Apply> 
 
    <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">4</AttributeValue> 
 
</Condition> 
 
    </Rule> 
 
    <Rule RuleId="FinalRule" Effect="Deny"/> 
 
</Policy>

를 생성 한

문제는 자원이 레벨 권한이 나는 대상의 레벨 권한과 자원의 레벨 허락하지만 난을 비교하려는 것입니다 어떻게하는지 모르겠다.

고마워요.

+0

내가 정확하게 당신이 뭘 하려는지 이해가 확실하지 않다 :

XACML 3.0의 출력은 다음과 같다. '수준 허가'란 무엇입니까? MLS 모델에서와 같이 액세스 수준이 일종의 (최대) 액세스 수준 (비밀, 일급 비밀 ...)을 가지며 각 리소스는 (최소) 액세스 수준을 갖습니다. 잘? –

+0

평범한 구식 영어 (또는 이탈리아어)로 최종 목표를 표현할 수 있습니까? 예를 들어, 역할 == manager를 가진 사용자는 문서 분류 <사용자 허가 만 있으면 X 유형의 문서에 대해 ==보기 동작을 수행하려고합니다. –

+0

또한 XACML 1.1 또는 XACML 2.0 정책과 비슷합니다. 정책을 생성하기 위해 당신은 무엇을 사용 했습니까? ALFA를 들여다 보았습니까? –

답변

0

거의 다 왔어. 예를 들어 두 속성을 함께 비교해야 할 때마다. user-clearanceresource-classification 인 경우 XACML Condition을 사용해야합니다. 귀하의 예제에서 그렇게하려고 시도했지만 속성을 정적 값과 비교했습니다.

다음은 ALFA (Axiomatics Language for Authorization)의 간단한 예입니다. 내가 문자열 대신 여기에 정수를 사용

attribute classification{ 
     category = resourceCat 
     id = "document.classification" 
     type = integer 
    } 

attribute clearance{ 
     category = subjectCat 
     id = "user.clearance" 
     type = integer 
    } 

참고 : 다음과 같이

policy documentAccess{ 
    apply firstApplicable 
    rule allowAccessIfClearanceSufficient{ 
     condition user.clearance>document.classification 
     permit 
    } 
} 

나는 나의 속성을 정의합니다. 더 효율적이고 안전합니다.

<?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/example.documentAccess" 
    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/example.documentAccess.allowAccessIfClearanceSufficient"> 
     <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-greater-than"/> 
       <xacml3:AttributeDesignator 
        AttributeId="user.clearance" 
        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="document.classification" 
        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>