15.7.4. HTTP/REDIRECT バインディングを使用したサービスプロバイダーの設定
サービスプロバイダー (SP) は JBoss EAP サーバーインスタンスである可能性があります。
手順15.2 サービスプロバイダー (SP) の設定
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>
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>
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>
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
へのカスタムパスを設定できます。任意設定:
picketlink.xml
へのカスタムパスの設定アプリケーションのWEB-INF/jboss-web.xml
でバルブ要素に、configFile
とtimerInterval
の 2 つのパラメーターを追加します。configFile
はpicketlink.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>
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>