为 Liberty 应用程序客户机容器配置 JAAS 定制登录模块

可配置 Liberty 应用程序客户机容器以使用定制 Java™ 认证和授权服务 (JAAS) 登录模块。

开始之前

请确保您有一个 JAR 文件包含 JAAS 定制登录模块,此模块用来实现 javax.security.auth.spi.LoginModule 接口。

关于此任务

可以使用定制登录模块来作出其他认证决策,或者在主体集中添加信息以在应用程序内部作出更细颗粒度的权限决策。要配置 JAAS 定制登录模块,请完成以下步骤。

过程

  1. appSecurityClient-1.0 功能部件添加至 client.xml 文件。
    <feature>appSecurityClient-1.0</feature>
  2. 创建用于实现 LoginModule 接口的 com.sample.CustomLoginModule 类并将其打包到 CustomLoginModule.jar 文件中。
  3. 创建一个 <library> 元素,该元素使用一个 <fileset> 元素指示 CustomLoginModule.jar 文件所在的位置。在此示例中,该文件在客户机的配置目录中,库标识为 customLoginLib
    <library id="customLoginLib">
             <fileset dir="${server.config.dir}" includes="CustomLoginModule.jar"/>
    </library>
  4. 创建 <jaasLoginModule> 元素。在此示例中,id 为 myCustom
    1. 通过将 controlFlag 属性设置为 REQUIRED,将定制登录模块配置为需要成功认证。
    2. libraryRef 属性设置为 customLoginLib(上一步中配置的 <library> 元素的标识)。
      <jaasLoginModule id="myCustom"  className="com.sample.CustomLoginModule" controlFlag="REQUIRED" libraryRef="customLoginLib"/>
  5. 在应用程序客户机容器 ClientContainer 上创建 <jaasLogincontextEntry> 元素,此元素带有系统定义的 JAAS 配置的标识和名称。您还可以将此 JAAS 配置设置为 WSLogin 或您自己的 JAAS 配置。在 loginModuleRef 属性中,添加 proxy代理登录模块的标识)和 myCustom(上一步中创建的 jaasLoginModule 元素的标识)。
    <jaasLoginContextEntry id="ClientContainer" name="ClientContainer" 
    		            loginModuleRef="proxy, myCustom"/>

用于指示主题类型的图标 任务主题



时间戳记图标 最近一次更新时间: Monday, 5 December 2016
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-libcore-mp&topic=twlp_config_jaas_custom_login_module
文件名:twlp_config_jaas_custom_login_module.html