5.6.3. 配置标识符提供者
配置标识符提供者(Identity Provider,IDP)是一个 JBoss EAP 服务器实例。
过程 5.1. 配置标识符提供者(IDP)
为 IDP 配置 web 应用程序的安全性
将 Web 应用程序配置为标识符提供者。注意
我们推荐使用基于 FORM 的 web 应用程序安全性,因为它可让你定制登录页面。下面是一个web.xml配置的例子例 5.6. IDP 的 web.xml 配置
<display-name>IDP</display-name> <description>IDP</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>IDP</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>IDP 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 IDP Application </description> <role-name>manager</role-name> </security-role> </web-app>配置 IDP Valve
在 IDP Web 程序里的 WEB-INF 目录里创建一个context.xml文件来配置 IDP Valve。下面是一个context.xml文件的例子。例 5.7. IDP Valve 的 context.xml 文件配置
<context> <Valve className="org.picketlink.identity.federation.bindings.tomcat.idp.IDPWebBrowserSSOValve"/> </context>配置 PicketLink 文件(picketlink.xml)
配置 IDP Web 程序的 WEB-INF 目录里的picketlink.xml。在这个配置文件里,你将为服务提供者和 IDP 提供转出 SAML2 评估里的 URL。下面是一个picketlink.xml文件的例子。例 5.8. picketlink-idfed.xml 配置
<PicketLink xmlns="urn:picketlink:identity-federation:config:2.1"> <PicketLinkIDP xmlns="urn:picketlink:identity-federation:config:2.1"> <IdentityURL>http://localhost:8080/idp/</IdentityURL> </PicketLinkIDP> <Handlers xmlns="urn:picketlink:identity-federation:handler:config:2.1"> <Handler class="org.picketlink.identity.federation.web.handlers.saml2.SAML2IssuerTrustHandler" /> <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>