像配置其他定制适配器一样配置用户注册表网桥。您可以将 Jython 或 Jacl 脚本编制语言与 wsadmin 脚本编制工具配合使用,以在联合存储库配置中定义用户注册表网桥。
开始之前
关闭 WebSphere® Application Server 和 wsadmin 命令窗口。
要点: 如果要从本地操作系统上的独立用户注册表迁移到本地操作系统上的联合存储库,那么必须先在联合存储库下配置当前用户注册表。有关更多信息,请参阅“在联合存储库配置中管理领域”。
如果在迁移前将用户或组映射到角色,且在迁移到用户注册表网桥后使用那些用户或组,那么授权可能会失败。发生此情况的原因是映射包含特定于注册表的信息。在迁移后,请重新映射用户或组以避免授权失败。
关于此任务
有关要用于本主题的命令的其他信息,请参阅 AdminTask 对象的 IdMgrRepositoryConfig 命令组。
执行以下步骤,将用户注册表网桥添加到任何联合存储库配置,及添加到该配置中所定义的任何领域。
过程
- 启动 wsadmin 脚本编制工具。 您可以使用以下命令来启动 wsadmin 脚本编制工具:
wsadmin –conntype none
- 使用 createIdMgrCustomRepository 命令,为用户注册表网桥添加新的存储库配置。
![[AIX Solaris HP-UX Linux Windows]](../images/dist.gif)
![[IBM i]](../images/iseries.gif)
以下示例将定制存储库配置为使用 com.ibm.ws.wim.adapter.urbridge.URBridge 类并将 urbcustom 设为标识:
- 使用 Jython:
AdminTask.createIdMgrCustomRepository('-id urbcustom
-adapterClassName com.ibm.ws.wim.adapter.urbridge.URBridge')
- 使用 Jacl:
$AdminTask createIdMgrCustomRepository {-id urbcustom
-adapterClassName com.ibm.ws.wim.adapter.urbridge.URBridge}
![[z/OS]](../images/ngzos.gif)
以下示例将定制存储库配置为使用 com.ibm.ws.wim.adapter.urbridge.URBridge 类并将 urbRACF 设为标识:
- 使用 Jython:
AdminTask.createIdMgrCustomRepository('-id urbRACF
-adapterClassName com.ibm.ws.wim.adapter.urbridge.URBridge')
- 使用 Jacl:
$AdminTask createIdMgrCustomRepository {-id urbRACF
-adapterClassName com.ibm.ws.wim.adapter.urbridge.URBridge}
避免故障: 用户注册表网桥仅处理对一个用户注册表发出的请求。因此,如果您定义多个存储库,那么每个用户注册表实现都必须具有用户注册表网桥的单独实例,并且您必须使用唯一的存储库标识将每个实现定义为单独的存储库。
资源访问控制设施 (RACF) 会管理所有 RACF 属性;因此,不需要添加任何定制属性即可将用户注册表网桥适配器与 RACF 配合使用。
gotcha
- 可选:
![[AIX Solaris HP-UX Linux Windows]](../images/dist.gif)
将必要的特定于注册表的属性添加为定制属性。 重复使用 setIdMgrCustomProperty 命令来添加多个属性。对每个属性使用此命令一次以便对配置添加多个属性。必须使用名称和值参数对指定存储库添加定制属性。例如,要添加定制属性 uniqueUserIdProperty,请输入以下命令:- 使用 Jython:
AdminTask.setIdMgrCustomProperty('-id urbcustom
-name uniqueUserIdProperty -value "uniqueId"')
- 使用 Jacl:
$AdminTask setIdMgrCustomProperty {-id urbcustom
-name uniqueUserIdProperty -value "uniqueId"}
要将用户注册表网桥配置为使用定制用户注册表,您必须添加 registryImplClass 属性并指定确切的注册表实现类。例如,将 com.xyz.abc.MyCustomRegistry 指定为此属性的值。
要将用户注册表网桥配置为使用本地操作系统用户注册表,请不要指定 registryImplClass 属性。用户注册表网桥可以标识 WebSphere Application Server 为本地操作系统提供的底层用户注册表实现。
您可以将其他可选属性设置为定制属性,以定义联合存储库属性和用户注册表属性之间的映射,例如,uniqueUserIdProperty、userSecurityNameProperty、userDisplayNameProperty、uniqueGroupIdProperty、groupSecurityNameProperty 和 groupDisplayNameProperty 等可选属性。有关可用定制属性及其缺省值的更多信息,请参阅“安全性定制属性”。要在用户注册表级别覆盖其中的任何属性,请将该属性配置为定制属性。
避免故障: 联合存储库属性与用户注册表属性之间的映射是一对一映射。只能将一个联合存储库属性映射至一个用户注册表属性。
gotcha
- 将基本条目添加到用户注册表网桥配置。 使用 addIdMgrRepositoryBaseEntry 命令对指定的存储库指定基本条目的名称。例如:
- 使用 Jython:
![[AIX Solaris HP-UX Linux Windows]](../images/dist.gif)
![[IBM i]](../images/iseries.gif)
AdminTask.addIdMgrRepositoryBaseEntry('-id urbcustom
-name o=custom')
![[z/OS]](../images/ngzos.gif)
AdminTask.addIdMgrRepositoryBaseEntry('-id urbRACF
-name o=local')
- 使用 Jacl:
![[AIX Solaris HP-UX Linux Windows]](../images/dist.gif)
![[IBM i]](../images/iseries.gif)
$AdminTask addIdMgrRepositoryBaseEntry {-id urbcustom
-name o=custom}
![[z/OS]](../images/ngzos.gif)
$AdminTask addIdMgrRepositoryBaseEntry {-id urbRACF
-name o=local}
- 使用 addIdMgrRealmBaseEntry 命令对领域添加基本条目以便将此领域链接到存储库。
注: 缺省领域名称是 defaultWIMFileBasedRealm。如果此领域先前已重命名,请使用新的领域名称取代 defaultWIMFileBasedRealm。例如,要确保一致性,您可以将联合存储库配置的领域名,设为在 security.xml 文件中对本地操作系统用户注册表指定的名称。有关如何设置领域名的信息,请参阅“领域配置设置”。
- 保存配置更改。 输入以下命令以保存新配置并关闭 wsadmin 脚本编制工具:
- 使用 Jython:
AdminConfig.save()
exit
- 使用 Jacl:
$AdminConfig save
exit
配置系统授权工具 (SAF) 映射模块,以确保 SAF 授权的属性可用性。 有关如何配置 SAF 映射模块的更多信息,请参阅“安装并配置 WebSphere Application Server 的定制系统授权工具映射模块”,其中已提供了样本 SAF 映射模块供您安装和使用。如果要定制联合存储库的样本 SAF 映射模块,请参阅“为联合存储库配置定制系统授权工具 (SAF) 映射模块”。
![[AIX Solaris HP-UX Linux Windows]](../images/dist.gif)
注: 如果您使用的是 SAF 分布式身份映射功能,那么不需要配置此映射模块。
注: 如果在除 defaultWIMFileBasedRealm 外的其他领域中配置了 RACF,那么可能需要执行其他步骤。创建新领域时,某些属性将采用缺省值,但这些缺省值与 defaultWIMFileBasedRealm 所使用的值不同且不适用于与联合 RACF 用户注册表配合使用。必须使用 setIdMgrRealmURAttrMapping 命令来设置以下值:
- userSecurityNameMapping 属性的值,必须将 propertyForOutput 参数设置为 principalName。
- groupSecurityNameMapping 属性的值,必须将 propertyForOutput 参数设置为 cn。
有关如何使用 setIdMgrRealmURAttrMapping 命令的更多信息,请参阅 AdminTask 对象的 IdMgrRealmConfig 命令组。
- 重新启动应用程序服务器。
结果
![[AIX Solaris HP-UX Linux Windows]](../images/dist.gif)
![[IBM i]](../images/iseries.gif)
以下代码举例说明了用户注册表网桥(对定制用户注册表进行访问)的
wimconfig.xml 文件中的基本配置:
<config:repositories adapterClassName="com.ibm.ws.wim.adapter.urbridge.URBridge" id="urbcustom">
<config:baseEntries name="o=custom"/>
<config:CustomProperties name="registryImplClass" value="com.ibm.registry.impl.FileRegistrySample"/>
<config:CustomProperties name="usersFile" value="${USER_PROPS}"/>
<config:CustomProperties name="groupsFile" value="${GROUP_PROPS}"/>
</config:repositories>
![[AIX Solaris HP-UX Linux Windows]](../images/dist.gif)
在先前示例中,${USER_PROPS} 和 ${GROUP_PROPS} 变量用于定义定制属性的值。
![[AIX Solaris HP-UX Linux Windows]](../images/dist.gif)
您可以使用变量来定义定制属性。然而,这些变量只在 WebSphere Application Server 连接方式下进行解析。有关如何定义环境变量的信息,请参阅“创建、编辑和删除 WebSphere 变量”。
![[z/OS]](../images/ngzos.gif)
以下代码是对用户注册表网桥(用于使用 RACF 来访问本地操作系统注册表)配置的 wimconfig.xml 文件的示例:
<config:repositories xsi:type="config:FileRepositoryType"
adapterClassName="com.ibm.ws.wim.adapter.file.was.FileAdapter"
id="InternalFileRepository" supportPaging="false"
messageDigestAlgorithm="SHA-1">
<config:baseEntries name="o=defaultWIMFileBasedRealm"/>
</config:repositories>
<config:repositories adapterClassName="com.ibm.ws.wim.adapter.urbridge.URBridge"
id="urbRACF" supportPaging="false">
<config:baseEntries name="o=local"/>
</config:repositories>
<config:realmConfiguration defaultRealm="defaultWIMFileBasedRealm">
<config:realms delimiter="/" name="defaultWIMFileBasedRealm" securityUse="active">
<config:participatingBaseEntries name="o=defaultWIMFileBasedRealm"/>
<config:participatingBaseEntries name="o=local"/>
<config:uniqueUserIdMapping propertyForInput="uniqueName"
propertyForOutput="uniqueName"/>
<config:userSecurityNameMapping propertyForInput="principalName"
propertyForOutput="principalName"/>
<config:userDisplayNameMapping propertyForInput="principalName"
propertyForOutput="principalName"/>
<config:uniqueGroupIdMapping propertyForInput="uniqueName"
propertyForOutput="uniqueName"/>
<config:groupSecurityNameMapping propertyForInput="cn"
propertyForOutput="cn"/>
<config:groupDisplayNameMapping propertyForInput="cn" propertyForOutput="cn"/>
</config:realms>
</config:realmConfiguration>