PicketLinkを見てみる(4) Federation - SPの設定について
4回目。前回のIdPの設定に引き続き、SPの設定。今回もUserGuide.pdfの丸写しに近い。
SP(sales.war)
web.xmlには、
User Guideには、Form認証の設定が必須であるように書いてあるが、このサンプルはJBossAS上では無くても動いた*2。
<!-- Define a Security Constraint on this Application --> <security-constraint> <web-resource-collection> <web-resource-name>SALES Application</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <auth-constraint> <role-name>manager</role-name> </auth-constraint> </security-constraint>
<!-- Security roles referenced by this web application --> <security-role> <description> The role that is required to log in to the Manager Application </description> <role-name>manager</role-name> </security-role>
context.xmlにはSP用のValveを指定。クラス名から見ると、やはりFormは必須なようにも見える。idp.warと同じく、context.xmlはMETA-INFとWEB-INF両方にあるが、META-INFのはTomcat用。WEB-INFのはJBoss用*3。RequestDumperValveはデバッグ用だろう。SPRedirectFormAuthenticatorが実際の処理を行っていると思われる。
<Context> <!-- log all incoming and outgoing messages. --> <Valve className="org.apache.catalina.valves.RequestDumperValve" /> <Valve className="org.picketlink.identity.federation.bindings.tomcat.sp.SPRedirectFormAuthenticator" /> </Context>
picketlink-idfed.xmlには、
<PicketLinkSP xmlns="urn:picketlink:identity-federation:config:1.0" ServerEnvironment="tomcat"> <IdentityURL>http://localhost:8080/idp/</IdentityURL> <ServiceURL>http://localhost:8080/sales/</ServiceURL> </PicketLinkSP>
picketlink-handlers.xmlにはハンドラを指定。クラス名からすると、SAML2LogOutHandlerがログアウト処理、SAML2AuthenticationHandlerが認証処理か。
<Handlers xmlns="urn:picketlink:identity-federation:handler:config:1.0"> <Handler class="org.picketlink.identity.federation.web.handlers.saml2.SAML2LogOutHandler"/> <Handler class="org.picketlink.identity.federation.web.handlers.saml2.SAML2AuthenticationHandler"/> </Handlers>
picketlink-sp-jboss-beans.xmlで、SPの認証ポリシーを指定。JBossの場合、これは$PROFILE/deploy/直下に配備した。SAML2LoginModuleクラスによる認証を指定している。
<deployment xmlns="urn:jboss:bean-deployer:2.0"> <application-policy xmlns="urn:jboss:security-beans:1.0" name="sp"> <authentication> <login-module code = "org.picketlink.identity.federation.bindings.jboss.auth.SAML2LoginModule" flag = "required" /> </authentication> </application-policy> </deployment>
とりあえず前回と今回の内容を元にすれば、自分で簡単なSAML認証ができるんじゃなかろうか。アプリを作ってみなきゃ。
そういえばログの確認を忘れていたので、次回はまずそこから。
それにしてもUser Guide が古すぎてあまり実情に合っていない。報告すべきかなー。