2.5. Web アプリケーションの設定
セキュリティードメインが設定されたら、Kerberos 認証を有効にするために、設定したセキュリティードメインを使用するよう web アプリケーションを設定する必要があります。アプリケーションを変更した後、JBoss EAP インスタンスにデプロイして認証に Kerberos を使用することができます。
アプリケーションに以下の更新を行う必要があります。
SPNEGO 認証メソッドを使用するよう
web.xml
を設定します。web.xml
ファイルには以下が含まれる必要があります。-
セキュアな領域の URL パターンにマップする
<url-pattern>
が含まれる<web-resource-collection>
を持つ<security-constraint>
。任意で、<security-constraint>
に許可されるロールを明記する<auth-constraint>
を含めることもできます。 -
<auth-constraint>
にロールが指定されている場合、これらのロールを<security-role>
で定義する必要があります。 SPNEGO
の正確な 値を持つ<auth-method>
が含まれる<login-config>
。重要<auth-method>
要素は特定の値のカンマ区切りリストを想定します。SPNEGO
認証を適切に設定するには、正確な値のSPNEGO
が最初に<auth-method>
要素に記載される必要があります。追加の認証タイプの取り入れについては「FORM ログインをフォールバックとして追加」を参照してください。<security-constraint>
および<security-role>
要素を使用すると、管理者は URL パターンおよびロールを基に制限された領域または無制限の領域をセットアップできます。これにより、リソースをセキュリティーで保護することができ、保護しないこともできます。例:
web.xml
ファイル<web-app> <display-name>App1</display-name> <description>App1</description> <!-- Define a security constraint that requires the Admin role to access resources --> <security-constraint> <display-name>Security Constraint on Conversation</display-name> <web-resource-collection> <web-resource-name>exampleWebApp</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <auth-constraint> <role-name>Admin</role-name> </auth-constraint> </security-constraint> <!-- Define the Login Configuration for this Application --> <login-config> <auth-method>SPNEGO</auth-method> <realm-name>SPNEGO</realm-name> </login-config> <!-- Security roles referenced by this web application --> <security-role> <description>Role required to log in to the Application</description> <role-name>Admin</role-name> </security-role> </web-app>
-
セキュアな領域の URL パターンにマップする
設定されたセキュリティードメインを使用するよう
jboss-web.xml
を設定します。jboss-web.xml
ファイルには以下が必要です。-
認証または承認に使用されるセキュリティードメインを指定する
<security-domain>
。 複数のロール名と照合するために
web.xml
の role-name 要素でアスタリスクの使用を有効にする<jacc-star-role-allow>
(任意)。例:
jboss-web.xml
ファイル<jboss-web> <security-domain>app-spnego</security-domain> <jacc-star-role-allow>true</jacc-star-role-allow> </jboss-web>
-
認証または承認に使用されるセキュリティードメインを指定する
JBoss Negotiation の依存関係をレガシー
security
サブシステムのデプロイメントに追加します。重要elytron
サブシステムを使用している場合は、この手順を省略できます。SPNEGO および JBoss Negotiation を使用する web アプリケーションでは、JBoss Negotiation クラスが見つかるようにするため、依存関係を
jboss-deployment-structure.xml
に定義する必要があります。JBoss EAP は必要なすべての JBoss Negotiation と関連クラスを提供するため、アプリケーションはこれらの依存関係を宣言して使用することのみが必要となります。jboss-deployment-structure.xml
を使用した依存関係の宣言<jboss-deployment-structure> <deployment> <dependencies> <module name="org.jboss.security.negotiation"/> </dependencies> </deployment> </jboss-deployment-structure>
この代わりに、依存関係を
META-INF/MANIFEST.MF
ファイルに定義することもできます。META-INF/MANIFEST.MF
を使用して依存関係の宣言Manifest-Version: 1.0 Dependencies: org.jboss.security.negotiation