5.6.4. 配置服务提供者


服务提供者(Service Provider,P)可以是一个 JBoss EAP 服务器实例。

过程 5.2. 配置服务提供者

  1. 为 SP 配置 Web 应用程序的安全性

    要配置为 SP 的 Web 应用程序应该在 web.xml 文件里启用基于 FORM 的安全性。

    例 5.9. SP 的 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>
    
    
    Copy to Clipboard Toggle word wrap
  2. 配置 SP Valve

    要配置 SP 的 Valve,请在 SP Web 应用程序里创建一个 context.xml 文件。

    例 5.10. IDP Valve 的 context.xml 文件配置

    <Context>
      <Valve className="org.jboss.identity.federation.bindings.tomcat.sp.SPRedirectSignatureFormAuthenticator" />
    </Context>
    
    
    Copy to Clipboard Toggle word wrap
  3. 配置 PicketLink Federation 的配置文件(picketlink-idfed.xml)

    配置 IDP Web 程序的 WEB-INF 目录里的 picketlink-idfed.xml。在这个配置文件里,你将为服务提供者和 IDP 提供转出 SAML2 评估里添加为发行者的 URL。下面是一个 picketlink-idfed.xml 文件的例子。

    例 5.11. picketlink-idfed.xml 配置

    <PicketLinkIDP xmlns="urn:picketlink:identity-federation:config:1.0" >
    <IdentityURL>http://localhost:8080/idp/</IdentityURL>
    </PicketLinkIDP
    
    
    Copy to Clipboard Toggle word wrap
  4. 配置 PicketLink Federation Handlers 文件(picketlink-handlers.xml)

    配置 SP web 应用程序的 WEB-INF 里的 picketlink-handlers.xml。WEB-INF of your SP web application.

    例 5.12. 配置 picketlink-handlers.xml

    <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>
    
    
    Copy to Clipboard Toggle word wrap

    注意

    请保留处理程序列出的顺序。
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat