使用 Ant 任务建立 LDAP 连接

可使用 Ant 任务来建立 LDAP 连接。

要使用 Ant 任务建立连接,请创建 XML 配置文件,并通过运行具有以下参数的 pload-ldapconfigs-def Ant 任务(位于 <InstallDir>/teamserver/bin/build.xml 中)来上载该配置文件:
  • -DldapConfigDefinitionsFilePath=<到 LDAP 定义文件的路径>

  • -Dserver.url=<Decision Center URL>

  • -DrtsAdmin.login=<用于登录 Decision Center 的用户名>

  • -DrtsAdmin.password=<用于登录 Decision Center 的密码>

  • -DdatasourceName=<数据源名称>

  • -Ddownload=<设置为 true 可从数据库下载现有文件而不是上载>

  • -Doutputfile=<用于保存已下载文件的路径>

例如:
ant upload-ldapconfigs-def -DldapConfigDefinitionsFilePath=C:\my_path\ldapconfigs.xml -Dserver.url=my_url -DrtsAdmin.login=rtsAdmin -DrtsAdmin.password=rtsAdmin -DdatasourceName=my_datasource
在配置文件中定义一个或多个 LDAP 连接。通过以下参数在 <ldapConnections> 标记中定义连接:
  • <ldapConnection="Name of the connection"/> - 声明连接的名称。
  • <ldapUrl> - 声明要连接的 LDAP 服务器 的 URL。
  • <searchConnectionDN> - 当你绑定到 LDAP 以进行搜索时所使用的完整目录名称。如果未指定,将进行匿名连接。
  • <searchConnectionPassword> - 用于 LDAP 搜索的密码。用于“搜索连接 DN”字段。
  • <groupSearchBase> - 用于组搜索的目录,如 ou=employees,dc=mydomain,dc=com。
  • <groupSearchFilter> - 代表组中成员的属性。
  • <groupNameAttribute> - 在组搜索返回的目录条目中包含用户组名称的条目的名称。如果未指定该条目,那么组搜索不会运行。例如,输入 cn。
  • <userNameAttribute> - 包含 LDAP 中用户名的属性。
  • <ldapProperties> - 用于任何其他所需 LDAP 属性。
  • <ldapProperty> - 用于每个其他所需 LDAP 属性。
  • <ldapPropertyName> - 其他所需 LDAP 属性的名称。
  • <ldapPropertyValue> - 其他所需 LDAP 属性的值。
以下示例显示了带有 LDAP 连接的 XML 配置文件。
<ldapConnections>
  <ldapConnection name="IBM Blue Pages">
    <ldapUrl>ldap://localhost:10389/</ldapUrl>
    <searchConnectionDN>uid=admin,ou=Users,dc=example,dc=com</searchConnectionDN>
    <searchConnectionPassword>secret</searchConnectionPassword>
    <groupSearchBase>ou=Groups,dc=example,dc=com</groupSearchBase>
    <groupSearchFilter>member</groupSearchFilter>
    <groupNameAttribute>cn</groupNameAttribute>
    <userNameAttribute>uid</userNameAttribute>
  </ldapConnection>
</ldapConnections>