【问题标题】:Gitlab ldap how to replace name field with last_name and first_nameGitlab ldap如何用last_name和first_name替换name字段
【发布时间】:2022-10-25 21:22:06
【问题描述】:

如何用 last_name 和 first_name 替换 name 字段?通过属性设置,不会从ldap中拉取值。可能是什么问题呢?

gitlab_rails['ldap_enabled'] = true
 gitlab_rails['ldap_servers'] = YAML.load <<-'EOS'
   main: # 'main' is the GitLab 'provider ID' of this LDAP server
     label: 'AD'
     host: 'example.com'
     port: 389
     uid: 'sAMAccountName'
     bind_dn: 'CN=gitlab,OU=general,DC=example,DC=com'
     password: 'pass'
     encryption: 'plain' # "start_tls" or "simple_tls" or "plain"
     verify_certificates: false
#     tls_options: { verify_mode: 'OpenSSL::SSL::VERIFY_NONE', ca_file: '', ssl_version: '', ciphers: '', cert: '', key: '' }
     smartcard_auth: false
     active_directory: true
     allow_username_or_email_login: false
     lowercase_usernames: true
     block_auto_created_users: false
     base: 'DC=example,DC=com'
     user_filter: ''
     attributes:
        username: ['uid', 'userid', 'sAMAccountName']
        email: ['mail', 'email', 'userPrincipalName']
        name: 'cn'
        first_name: 'givenName'
        last_name: 'sn'
EOS

LDAP attributes example

【问题讨论】:

    标签: authentication gitlab ldap


    【解决方案1】:

    您可以设置一个空字符串,以便它回退到使用名字+姓氏。

    引用自documentation

    姓名:用户显示名称的 LDAP 属性。如果 name 为空,则全名取自 first_namelast_name

    属性'cn''displayName' 通常带有全名。 或者,您可以通过以下方式强制使用 first_namelast_name 指定不存在的属性,例如 'somethingNonExistent'

    【讨论】:

    • 试过了,没用
    • 官方文档实际上在这里回答了您的问题,所以也许您问错了问题,和/或问题来自一开始没有正确配置 first_name 和 last_name,或者.. 事实上,没有更多信息没有帮助,很难说。您仍然可以编辑您的帖子,描述您如何实际测试配置,使用哪个用户(具有 sn 和 givenName 属性的 ldap 记录示例),您期望的位置姓名出现,日志在说什么,等等。
    猜你喜欢
    • 2016-01-10
    • 2012-07-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多