11.6.3.2. 粒度の細かい承認のための XACML の設定


XACML を設定する手順は次のとおりです。

手順11.10 XACML の設定

  1. 単一の jar ファイルであるライブラリーをダウンロードします。
  2. XACML のポリシーファイルを 1 つ以上作成

    • WEB-INF/classes で、すべてのポリシーを保存する policies ディレクトリーを作成します。
    • WEB-INF/classes ディレクトリーに policyConfig.xml を作成します。
      以下は、2 種類のポリシーセットを定義できます。
      • Role Permission Policy Sets(RPS)
      • パーミッションポリシーセット(PPS)

    例11.9 Role Permission Policy Sets(RPS)

    Employee

        <PolicySet xmlns="urn:oasis:names:tc:xacml:2.0:policy:schema:os"  
        PolicySetId="RPS:employee:role"  
        PolicyCombiningAlgId="urn:oasis:names:tc:xacml:1.0:policy-combining-algorithm:permit-overrides">  
        <Target>  
        <Subjects>  
        <Subject>  
        <SubjectMatch MatchId="urn:oasis:names:tc:xacml:1.0:function:anyURI-equal">  
        <AttributeValue  
        DataType="http://www.w3.org/2001/XMLSchema#anyURI">employee</AttributeValue>  
        <SubjectAttributeDesignator  
        AttributeId="urn:oasis:names:tc:xacml:2.0:subject:role"  
        DataType="http://www.w3.org/2001/XMLSchema#anyURI"/>  
        </SubjectMatch>  
        </Subject>  
        </Subjects>  
        </Target>  
        <!-- Use permissions associated with the employee role -->  
        <PolicySetIdReference>PPS:employee:role</PolicySetIdReference>  
        </PolicySet>
    
    
    Copy to Clipboard Toggle word wrap

    Manager

    <PolicySet xmlns="urn:oasis:names:tc:xacml:2.0:policy:schema:os"  
    PolicySetId="RPS:manager:role"  
    PolicyCombiningAlgId="urn:oasis:names:tc:xacml:1.0:policy-combining-algorithm:permit-overrides">  
    <Target>  
    <Subjects>  
    <Subject>  
    <SubjectMatch MatchId="urn:oasis:names:tc:xacml:1.0:function:anyURI-equal">  
    <AttributeValue  
    DataType="http://www.w3.org/2001/XMLSchema#anyURI">manager</AttributeValue>  
    <SubjectAttributeDesignator  
    AttributeId="urn:oasis:names:tc:xacml:2.0:subject:role"  
    DataType="http://www.w3.org/2001/XMLSchema#anyURI"/>  
    </SubjectMatch>  
    </Subject>  
    </Subjects>  
    </Target>  
    <!-- Use permissions associated with the manager role -->  
    <PolicySetIdReference>PPS:manager:role</PolicySetIdReference>  
    </PolicySet>
    
    
    Copy to Clipboard Toggle word wrap

    例11.10 パーミッションポリシーセット(PPS)

    Employee

        <PolicySet xmlns="urn:oasis:names:tc:xacml:2.0:policy:schema:os"  
            PolicySetId="PPS:employee:role"  
            PolicyCombiningAlgId="urn:oasis:names:tc:xacml:1.0:policy-combining-algorithm:permit-overrides">  
            <Target />  
            <!-- Permissions specifically for the employee role -->  
            <Policy PolicyId="Permissions:specifically:for:the:employee:role"  
                RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:permit-overrides">  
                <Target />  
                <!-- Permission to create a purchase order -->  
                <Rule RuleId="Permission:to:create:a:purchase:order" Effect="Permit">  
                    <Target>  
                        <Resources>  
                            <Resource>  
                                <ResourceMatch  
                                    MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">  
                                    <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">purchase order  
                                    </AttributeValue>  
                                    <ResourceAttributeDesignator  
                                        AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" DataType="http://www.w3.org/2001/XMLSchema#string" />  
                                </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">create</AttributeValue>  
                                    <ActionAttributeDesignator AttributeId="urn:action-id"  
                                        DataType="http://www.w3.org/2001/XMLSchema#string" />  
                                </ActionMatch>  
                            </Action>  
                        </Actions>  
                    </Target>  
                </Rule>  
            </Policy>  
            <!-- HasPrivilegesOfRole Policy for employee role -->  
        <Policy PolicyId="Permission:to:have:employee:role:permissions"  
            RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:permit-overrides">  
            <Target />  
            <!-- Permission to have employee role permissions -->  
            <Rule RuleId="Permission:to:have:employee:permissions" Effect="Permit">  
                <Condition>  
                    <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:and">  
                        <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:anyURI-is-in">  
                            <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#anyURI">employee</AttributeValue>  
                            <ResourceAttributeDesignator  
                                AttributeId="urn:oasis:names:tc:xacml:2.0:subject:role" DataType="http://www.w3.org/2001/XMLSchema#anyURI" />  
                        </Apply>  
                        <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:anyURI-is-in">  
                            <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#anyURI">urn:oasis:names:tc:xacml:2.0:actions:hasPrivilegesOfRole  
                            </AttributeValue>  
                            <ActionAttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id"  
                                DataType="http://www.w3.org/2001/XMLSchema#anyURI" />  
                        </Apply>  
                    </Apply>  
                </Condition>  
            </Rule>  
        </Policy>  
        </PolicySet>
    
    
    Copy to Clipboard Toggle word wrap

    Manager

    <PolicySet xmlns="urn:oasis:names:tc:xacml:2.0:policy:schema:os"  
            PolicySetId="PPS:manager:role"  
            PolicyCombiningAlgId="urn:oasis:names:tc:xacml:1.0:policy-combining-algorithm:permit-overrides">  
            <Target />  
            <!-- Permissions specifically for the manager role -->  
            <Policy PolicyId="Permissions:specifically:for:the:manager:role"  
                RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:permit-overrides">  
                <Target />  
                <!-- Permission to sign a purchase order -->  
                <Rule RuleId="Permission:to:sign:a:purchase:order" Effect="Permit">  
                    <Target>  
                        <Resources>  
                            <Resource>  
                                <ResourceMatch  
                                    MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">  
                                    <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">purchase order  
                                    </AttributeValue>  
                                    <ResourceAttributeDesignator  
                                        AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" DataType="http://www.w3.org/2001/XMLSchema#string" />  
                                </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">sign</AttributeValue>  
                                    <ActionAttributeDesignator AttributeId="urn:action-id"  
                                        DataType="http://www.w3.org/2001/XMLSchema#string" />  
                                </ActionMatch>  
                            </Action>  
                        </Actions>  
                    </Target>  
                </Rule>  
            </Policy>  
            <!-- HasPrivilegesOfRole Policy for manager role -->  
        <Policy PolicyId="Permission:to:have:manager:role:permissions"  
            RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:permit-overrides">  
            <Target />  
            <!-- Permission to have manager role permissions -->  
            <Rule RuleId="Permission:to:have:manager:permissions" Effect="Permit">  
                <Condition>  
                    <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:and">  
                        <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:anyURI-is-in">  
                            <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#anyURI">manager</AttributeValue>  
                            <ResourceAttributeDesignator  
                                AttributeId="urn:oasis:names:tc:xacml:2.0:subject:role" DataType="http://www.w3.org/2001/XMLSchema#anyURI" />  
                        </Apply>  
                        <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:anyURI-is-in">  
                            <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#anyURI">urn:oasis:names:tc:xacml:2.0:actions:hasPrivilegesOfRole  
                            </AttributeValue>  
                            <ActionAttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id"  
                                DataType="http://www.w3.org/2001/XMLSchema#anyURI" />  
                        </Apply>  
                    </Apply>  
                </Condition>  
            </Rule>  
        </Policy>  
            <!-- Include permissions associated with employee role -->  
            <PolicySetIdReference>PPS:employee:role</PolicySetIdReference>  
        </PolicySet>
    
    
    Copy to Clipboard Toggle word wrap

  3. XACML エンジンの設定ファイルを作成します。

    ロケーターを設定し、ポリシーが保存されるディレクトリーに言及するために設定ファイルが作成されます。

    例11.11 設定ファイル

    Directory Of the Policy Files のみを示す設定ファイル。

        <ns:jbosspdp xmlns:ns="urn:jboss:xacml:2.0">  
          <ns:Policies>   
           <ns:PolicySet>  
              <ns:Location>test/policies/rbac/</ns:Location>   
            </ns:PolicySet>  
          </ns:Policies>  
          <ns:Locators>  
            <ns:Locator Name="org.jboss.security.xacml.locators.JBossRBACPolicySetLocator"/>  
          </ns:Locators>  
        </ns:jbosspdp>
    
    
    Copy to Clipboard Toggle word wrap

    ポリシーセットの定義

    <ns:jbosspdp xmlns:ns="urn:jboss:xacml:2.0">  
      <ns:Policies>    
        <ns:PolicySet>  
          <ns:Location>test/policies/rbac/employee-PPS-policyset.xml</ns:Location>   
        </ns:PolicySet>  
        <ns:PolicySet>  
          <ns:Location>test/policies/rbac/manager-PPS-policyset.xml</ns:Location>   
        </ns:PolicySet>  
        <ns:PolicySet>  
          <ns:Location>test/policies/rbac/employee-RPS-policyset.xml</ns:Location>   
        </ns:PolicySet>  
        <ns:PolicySet>  
          <ns:Location>test/policies/rbac/manager-RPS-policyset.xml</ns:Location>   
        </ns:PolicySet>  
      </ns:Policies>  
      <ns:Locators>  
        <ns:Locator Name="org.jboss.security.xacml.locators.JBossRBACPolicySetLocator"/>  
      </ns:Locators>  
    </ns:jbosspdp>
    
    
    Copy to Clipboard Toggle word wrap

  4. Policy Decision Point(PDP)を作成して、設定ファイルに渡します。
  5. Policy Enforcement Point(PEP)で、コンテキストに基づいて XACML リクエストを作成します。XACML リクエストを PDP に渡して、以下のアクセス決定の 1 つを取得します。
    • permit
    • 却下
    • Indeterminate
    • 適用外

    例11.12 Decisions へのアクセス

    許可条件

        <Request   
              xmlns="urn:oasis:names:tc:xacml:2.0:context:schema:os"  
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
              xsi:schemaLocation="urn:oasis:names:tc:xacml:2.0:context:schema:os  
                 access_control-xacml-2.0-context-schema-os.xsd">  
        <Subject>  
        <Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id"  
         DataType="http://www.w3.org/2001/XMLSchema#string">  
        <AttributeValue>Anne</AttributeValue>  
        </Attribute>  
          
        <Attribute AttributeId="urn:oasis:names:tc:xacml:2.0:subject:role"  
         DataType="http://www.w3.org/2001/XMLSchema#anyURI">  
        <AttributeValue>manager</AttributeValue>  
        </Attribute>  
        </Subject>   
          
        <Resource>  
        <Attribute AttributeId="urn:oasis:names:tc:xacml:2.0:subject:role"  
        DataType="http://www.w3.org/2001/XMLSchema#anyURI">  
        <AttributeValue>manager</AttributeValue>  
        </Attribute>  
        </Resource>  
          
        <Action>  
        <Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id"  
         DataType="http://www.w3.org/2001/XMLSchema#anyURI">  
         <AttributeValue>urn:oasis:names:tc:xacml:2.0:actions:hasPrivilegesOfRole</AttributeValue>  
        </Attribute>  
        </Action>  
        </Request>
    
    
    Copy to Clipboard Toggle word wrap

    パーミッションの拒否

        <Request xmlns="urn:oasis:names:tc:xacml:2.0:context:schema:os"  
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
            xsi:schemaLocation="urn:oasis:names:tc:xacml:2.0:context:schema:os  
                 access_control-xacml-2.0-context-schema-os.xsd">  
            <Subject>  
                <Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id"  
                    DataType="http://www.w3.org/2001/XMLSchema#string">  
                    <AttributeValue>Anne</AttributeValue>  
                </Attribute>  
          
                <Attribute AttributeId="urn:oasis:names:tc:xacml:2.0:subject:role"  
                    DataType="http://www.w3.org/2001/XMLSchema#anyURI">  
                    <AttributeValue>manager</AttributeValue>  
                </Attribute>  
            </Subject>  
          
            <Resource>  
                <Attribute AttributeId="urn:oasis:names:tc:xacml:2.0:subject:role"  
                    DataType="http://www.w3.org/2001/XMLSchema#anyURI">  
                    <AttributeValue>manager</AttributeValue>  
                </Attribute>  
            </Resource>  
          
            <Action>  
                <Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id"  
                    DataType="http://www.w3.org/2001/XMLSchema#anyURI">  
                    <AttributeValue>urn:nobody</AttributeValue>  
                </Attribute>  
            </Action>  
        </Request>
    
    
    Copy to Clipboard Toggle word wrap

トップに戻る
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。 最新の更新を見る.

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

Theme

© 2025 Red Hat