15.7.4. HTTP/REDIRECT バインディングを使用したサービスプロバイダーの設定

サービスプロバイダー (SP) は JBoss EAP サーバーインスタンスである可能性があります。

手順15.2 サービスプロバイダー (SP) の設定

  1. SP の Web アプリケーションセキュリティーの設定

    SP として設定する Web アプリケーションの web.xml ファイルで、FORM ベースのセキュリティーを有効にする必要があります。

    例15.11 SP の web.xml 設定

    <display-name>SP</display-name>
    <description>SP</description>
    <!-- Define a security constraint that gives unlimited access to images -->
    <security-constraint>
      <web-resource-collection>
        <web-resource-name>Images</web-resource-name>
        <url-pattern>/images/*</url-pattern>
      </web-resource-collection>
    </security-constraint>
    <!-- Define a Security Constraint on this Application -->
    <security-constraint>
      <web-resource-collection>
        <web-resource-name>SP</web-resource-name>
        <url-pattern>/*</url-pattern>
      </web-resource-collection>
      <auth-constraint>
        <role-name>manager</role-name>
      </auth-constraint>
    </security-constraint>
    <!-- Define the Login Configuration for this Application -->
    <login-config>
      <auth-method>FORM</auth-method>
      <realm-name>SP Application</realm-name>
      <form-login-config>
        <form-login-page>/jsp/login.jsp</form-login-page>
        <form-error-page>/jsp/loginerror.jsp</form-error-page>
      </form-login-config>
    </login-config>
    <!-- Security roles referenced by this web application -->
    <security-role>
        <description>
       The role that is required to log in to the SP Application
      </description>
      <role-name>manager</role-name>
    </security-role>
    </web-app>
  2. SP のセキュリティードメインの作成

    SAML2LoginModule を使用するセキュリティードメインを作成します。以下に設定例を示します。
    <security-domain name="sp" cache-type="default">
      <authentication>
        <login-module code="org.picketlink.identity.federation.bindings.jboss.auth.SAML2LoginModule" flag="required"/>
       </authentication>
    </security-domain>
  3. SP バルブの設定

    SP のバルブを設定するには、SP Web アプリケーションの WEB-INF ディレクトリーに jboss-web.xml を作成します。

    例15.12 SP バルブの jboss-web.xml ファイル設定

    <jboss-web>
      <security-domain>sp</security-domain>
      <context-root>sales-post</context-root>
      <valve>
        <class-name>org.picketlink.identity.federation.bindings.tomcat.sp.ServiceProviderAuthenticator</class-name>
      </valve>
    </jboss-web>
  4. PicketLink 設定ファイル (picketlink.xml) の設定

    以下は SP の picketlink.xml 設定の例になります。この設定ファイルで、対応する SP のハンドラーを用いて SP および IDP の URL を指定します。

    例15.13 picketlink.xml 設定

    <PicketLink xmlns="urn:picketlink:identity-federation:config:2.1">
      <PicketLinkSP xmlns="urn:picketlink:identity-federation:config:2.1" ServerEnvironment="tomcat" BindingType="REDIRECT">
        <IdentityURL>${idp.url::http://localhost:8080/idp/}</IdentityURL>
        <ServiceURL>${sales-post.url::http://localhost:8080/sales-post/}</ServiceURL>
      </PicketLinkSP>
      <Handlers xmlns="urn:picketlink:identity-federation:handler:config:2.1">
        <Handler class="org.picketlink.identity.federation.web.handlers.saml2.SAML2LogOutHandler" />
        <Handler class="org.picketlink.identity.federation.web.handlers.saml2.SAML2AuthenticationHandler" />
        <Handler class="org.picketlink.identity.federation.web.handlers.saml2.RolesGenerationHandler" />
      </Handlers>
    </PicketLink>
    デフォルトでは、picketlink.xml はアプリケーションの WEB-INF ディレクトリーにありますが、アプリケーションの外部にある picketlink.xml へのカスタムパスを設定できます。
    1. 任意設定: picketlink.xml へのカスタムパスの設定

      アプリケーションの WEB-INF/jboss-web.xml でバルブ要素に、configFiletimerInterval の 2 つのパラメーターを追加します。configFilepicketlink.xml へのパスを指定し、timerInterval は設定を再ロードする間隔をミリ秒単位で指定します。例を以下に示します。
      <valve>
        <class-name>...</class-name>
          <param>
            <param-name>timerInterval</param-name>
            <param-value>5000</param-value>
          </param>
          <param>
            <param-name>configFile</param-name>
            <param-value>path-to/picketlink.xml</param-value>
          </param>
      </valve>
  5. PicketLink モジュール (META-INF/MANIFEST.MF または jboss-deployment-structure.xml) での依存関係の宣言

    PicketLink クラスの場所を特定できるようにするため、Web アプリケーションには META-INF/MANIFEST.MF または jboss-deployment-structure.xml に定義される依存関係が必要です。

    例15.14 META-INF/MANIFEST.MF での依存関係の定義

    Manifest-Version: 1.0
        Build-Jdk: 1.6.0_24
        Dependencies: org.picketlink

    例15.15 META-INF/jboss-deployment-structure.xml での依存関係の定義

    <jboss-deployment-structure>  
      <deployment>    
        <dependencies>
          <module name="org.picketlink" />
        </dependencies>
      </deployment>
    </jboss-deployment-structure>