0

現在、XACML を使用して簡単なポリシーを作成しようとしています。残念ながら、私の XACML エンジンは私の要求に適用できるポリシーを見つけていないようです。

私がやったことは次のとおりです。

ポリシー :

    <Policy xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17"
    PolicyId="testPolicy-Quota-Storage"
    RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:permit-overrides"
    Version="3.0">
<Target></Target>
    <Rule Effect="Permit" RuleId="Permit-Quota-Storage">
        <Description>Quota-Storage Rule : request for storage > 2500mb implies
            that if the profile of a user allows it, the storage plan is scaled
            up
        </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">premium</AttributeValue>
                        <AttributeDesignator
                            AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id-qualifier"
                            Category="urn:oasis:names:tc:xacml:1.0:subject-category:recipient-subject"
                            DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false" />
                    </Match>


                    <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
                        <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">store</AttributeValue>
                        <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="false" />
                    </Match>
                    <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:integer-greater-than">

                        <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#integer">2500</AttributeValue>

                        <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#integer"
                            MustBePresent="false" />

                    </Match>

                </AllOf>
            </AnyOf>
        </Target>

    </Rule>
    <Rule Effect="Deny" RuleId="Deny-1">
        <Target>
            <AnyOf>
                <AllOf>
                    <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
                        <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">fixed</AttributeValue>
                        <AttributeDesignator
                            AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id-qualifier"
                            Category="urn:oasis:names:tc:xacml:1.0:subject-category:recipient-subject"
                            DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false" />
                    </Match>
                </AllOf>
            </AnyOf>

        </Target>
    </Rule>

</Policy>

リクエスト :

 <xacml-ctx:Request ReturnPolicyIdList="false" CombinedDecision="false" xmlns:xacml-ctx="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17">
   <xacml-ctx:Attributes Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" >
      <xacml-ctx:Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" IncludeInResult="false">
         <xacml-ctx:AttributeValue DataType="http://www.w3.org/2001/XMLSchema#integer">2500</xacml-ctx:AttributeValue>
      </xacml-ctx:Attribute>
   </xacml-ctx:Attributes>
   <xacml-ctx:Attributes Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action" >
      <xacml-ctx:Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" IncludeInResult="false">
         <xacml-ctx:AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">store</xacml-ctx:AttributeValue>
      </xacml-ctx:Attribute>
   </xacml-ctx:Attributes>
   <xacml-ctx:Attributes Category="urn:oasis:names:tc:xacml:1.0:subject-category:recipient-subject" >
      <xacml-ctx:Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id-qualifier" IncludeInResult="false">
         <xacml-ctx:AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">fixed</xacml-ctx:AttributeValue>
      </xacml-ctx:Attribute>
      <xacml-ctx:Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id" IncludeInResult="false">
         <xacml-ctx:AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">alice@company.com</xacml-ctx:AttributeValue>
      </xacml-ctx:Attribute>
   </xacml-ctx:Attributes>
</xacml-ctx:Request>
4

1 に答える 1

1

以下を使用してポリシーを確認しました。

  • 公理のポリシー管理ポイント
  • Notepad++ による標準 XML スキーマ検証プラグイン

検証エラー

どちらの場合も、検証で検証エラーが返されました。

エラー: 要素 '{urn:oasis:names:tc:xacml:3.0:core:schema:wd-17}Rule': この要素は想定されていません。( {urn:oasis:names:tc:xacml:3.0:core:schema:wd-17}Description, {urn:oasis:names:tc:xacml:3.0:core:schema:wd-17}PolicyIssuer のいずれかが期待されます、{urn:oasis:names:tc:xacml:3.0:core:schema:wd-17}PolicyDefaults、{urn:oasis:names:tc:xacml:3.0:core:schema:wd-17}Target )。

あなたが書いたポリシーは有効な XACML 3.0 ではありません。ポリシーを手で書いた場合、いくつかの要素が欠けています。ポリシーをツールで作成した場合は、ツールを変更することをお勧めします。たとえば、Eclipse 用の ALFA プラグインを使用します。これを使用してポリシーを作成するのは簡単です。ここ を参照してください。非商用の場合は無料です。

不足している要素を追加するようにポリシーを修正しました。別の検証を実行して取得しました

エラー: 要素 '{urn:oasis:names:tc:xacml:3.0:core:schema:wd-17}Match': この要素は想定されていません。期待されるのは ( {urn:oasis:names:tc:xacml:3.0:core:schema:wd-17}AnyOf ) です。

これは、ルールのターゲットDeny-1も無効であることを意味します。Match 要素の周りに AllOf/AnyOf 要素がありません。

公理 PAP 内のポリシー

これら 2 つのエラーを修正したら、Axiomatics PAP 内にポリシーをインポートできました。インポートすると、UI に次のようにポリシーが表示されます。

公理のポリシー管理ポイント

ポリシーに対するリクエストのシミュレート

次に、ポリシーに対してリクエストを実行しました

Axiomatics PAP Simulator 内の XACML リクエスト

このブログ投稿で説明されているように、あなたのリクエストが実際には複数の決定リクエストであることが既にわかります。おそらく、そのようなリクエストを作成するつもりはなく、複数のサブジェクト属性を持つリクエストを作成するつもりでした。したがって、リクエストは

<xacml-ctx:Request ReturnPolicyIdList="false" CombinedDecision="false" xmlns:xacml-ctx="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17">
   <xacml-ctx:Attributes Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" >
      <xacml-ctx:Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" IncludeInResult="false">
         <xacml-ctx:AttributeValue DataType="http://www.w3.org/2001/XMLSchema#integer">2600</xacml-ctx:AttributeValue>
      </xacml-ctx:Attribute>
   </xacml-ctx:Attributes>
   <xacml-ctx:Attributes Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action" >
      <xacml-ctx:Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" IncludeInResult="false">
         <xacml-ctx:AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">store</xacml-ctx:AttributeValue>
      </xacml-ctx:Attribute>
   </xacml-ctx:Attributes>
   <xacml-ctx:Attributes Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" >
      <xacml-ctx:Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id-qualifier" IncludeInResult="false">
         <xacml-ctx:AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">premium</xacml-ctx:AttributeValue>
      </xacml-ctx:Attribute>
      <xacml-ctx:Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id" IncludeInResult="false">
         <xacml-ctx:AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">alice@company.com</xacml-ctx:AttributeValue>
      </xacml-ctx:Attribute>
   </xacml-ctx:Attributes>
</xacml-ctx:Request>

あなたが指摘したように、評価の結果はまだNotApplicableです。その理由は、値を正規化していないためです。たとえば、リクエストは使用しますpremiumが、ポリシーは使用しますpremium(whitespace)。空白は重要です。

最後に、このエラーが修正されると、プレミアムや 2500 などで適切な値を送信しなかったため、NotApplicable が返されます。このスクリーンショットで評価トレースを確認できます

ここに画像の説明を入力

于 2015-09-16T09:19:28.753 に答える