【问题标题】:Concatenate givenName and sn attribute as display name in Jenkins LDAP plugin将 givenName 和 sn 属性连接为 Jenkins LDAP 插件中的显示名称
【发布时间】:2016-03-08 08:48:08
【问题描述】:

我终于设法通过Jenkins LDAP plugin 连接到我公司的 Active Directory。虽然一切正常,但我发现登录用户的显示名称与预期不符。

我在 Jenkins 安全配置中将字段 Display Name LDAP attribute 配置为 displayName。但是我的公司决定将其名称附加到 AD 中的每个 displayNameattribute 中。我想摆脱它,因为使用内部 Jenkins 我们知道我们在哪里工作:)

我的想法是简单地从另一个 AD 属性中读取显示名称,但没有一个包含完全名后跟姓氏的名称。 问题是:有没有办法在 Jenkins LDAP 插件中连接两个或多个 AD 属性?

我想拥有“姓氏姓氏”,并且可以选择以下 AD 属性:

  • name = "Forename Surname" 或 "forename.surname"(烦人)
  • displayName = "姓氏 | 公司"
  • givenName = "名字"
  • sn = "姓氏"

在 Java 语法中我只想要givenName + " " + sn。在 Jenkins LDAP 插件中有没有办法做到这一点?

【问题讨论】:

    标签: jenkins active-directory ldap jenkins-plugins


    【解决方案1】:

    查看source code of the Jenkins LDAP plugin,它看起来不允许连接。您作为显示名称属性提供的内容必须与一个属性的名称完全匹配。

    这些是我所指的行(从第 729 行开始):

    Attribute attribute = d.getAttributes().get(getDisplayNameAttributeName());
    String displayName = attribute == null ? null : (String) attribute.get();
    if (StringUtils.isNotBlank(displayName) && u.getId().equals(u.getFullName()) && !u.getFullName().equals(displayName)) {
        u.setFullName(displayName);
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-07-11
      • 1970-01-01
      • 1970-01-01
      • 2013-07-05
      • 1970-01-01
      • 1970-01-01
      • 2017-04-02
      • 2016-08-14
      相关资源
      最近更新 更多