AD-attributes not joined with spaces on LDAP_DISPLAY_NAME_ATTRIBUTE #5373

Closed
opened 2026-02-05 10:00:49 +03:00 by OVERLORD · 4 comments
Owner

Originally created by @Tomblarom on GitHub (Jul 22, 2025).

Describe the Bug

In our company, the AD-attribute DisplayName is storing the surname first, joined by a space and the givenName:

SN                 : Doe
Surname            : Doe
GivenName          : John
DisplayName        : Doe John
DistinguishedName  : CN=DoeJ,OU=Employees,OU=Company_Users,DC=company,DC=com
EmailAddress       : John.Doe@company.com
SamAccountName     : DoeJ

When I use the env LDAP_DISPLAY_NAME_ATTRIBUTE=displayName like this, it's obiously swapped:

Image

We want to have the given name be shown in the top right and the full name displayed in the profile. Unfortunately, when setting the env LDAP_DISPLAY_NAME_ATTRIBUTE=GivenName|Surname like this, it's not joined with spaces, as claimed here. The name in the top right is correct, but under profle, only the GivenName is displayed and missing the space and Surname:

Image

Steps to Reproduce

  1. Setup LADP for bookstack
  2. Set env LDAP_DISPLAY_NAME_ATTRIBUTE=GivenName|Surname

Browser Details

Google Chrome 138.0.7204.101 (Official Build) (64-bit)

Exact BookStack Version

v25.05.2

Originally created by @Tomblarom on GitHub (Jul 22, 2025). ### Describe the Bug In our company, the AD-attribute `DisplayName` is storing the `surname` first, joined by a space and the `givenName`: ``` SN : Doe Surname : Doe GivenName : John DisplayName : Doe John DistinguishedName : CN=DoeJ,OU=Employees,OU=Company_Users,DC=company,DC=com EmailAddress : John.Doe@company.com SamAccountName : DoeJ ``` When I use the env `LDAP_DISPLAY_NAME_ATTRIBUTE=displayName` like this, it's obiously swapped: <img width="895" height="271" alt="Image" src="https://github.com/user-attachments/assets/fe0811a4-9efa-471a-8690-c7910f9455d8" /> We want to have the given name be shown in the top right and the full name displayed in the profile. Unfortunately, when setting the env `LDAP_DISPLAY_NAME_ATTRIBUTE=GivenName|Surname` like this, it's not joined with spaces, as [claimed here](https://www.bookstackapp.com/docs/admin/ldap-auth/). The name in the top right is correct, but under profle, only the `GivenName` is displayed and missing the space and `Surname`: <img width="895" height="271" alt="Image" src="https://github.com/user-attachments/assets/01c60542-983f-450f-88c3-d612c1f31158" /> ### Steps to Reproduce 1. Setup LADP for bookstack 2. Set env `LDAP_DISPLAY_NAME_ATTRIBUTE=GivenName|Surname` ### Browser Details Google Chrome 138.0.7204.101 (Official Build) (64-bit) ### Exact BookStack Version v25.05.2
OVERLORD added the 🐛 Bug label 2026-02-05 10:00:49 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Jul 22, 2025):

Hi @Tomblarom,

Can you share the output seen (obscuring any private details) when LDAP_DUMP_USER_DETAILS=true is set in the config for BookStack? Just want to ensure that those properties are being provided under the expected names.

That setting will block user logins and log information to the screen while active, so disable/remove the option again after getting the requested info.

@ssddanbrown commented on GitHub (Jul 22, 2025): Hi @Tomblarom, Can you share the output seen (obscuring any private details) when `LDAP_DUMP_USER_DETAILS=true` is set in the config for BookStack? Just want to ensure that those properties are being provided under the expected names. That setting will block user logins and log information to the screen while active, so disable/remove the option again after getting the requested info.
Author
Owner

@Tomblarom commented on GitHub (Jul 22, 2025):

Hey @ssddanbrown, thanks for your reply. Here is the (censored) output:

{
  "details_from_ldap": {
    "cn": {
      "count": 1,
      "0": "DoeJ"
    },
    "0": "cn",
    "givenname": {
      "count": 1,
      "0": "John"
    },
    "1": "givenname",
    "mail": {
      "count": 1,
      "0": "John.Doe@company.com"
    },
    "2": "mail",
    "jpegphoto": {
      "count": 1,
      "0": "????\u0000...\u0000"
    },
    "3": "jpegphoto",
    "count": 4,
    "dn": "CN=DoeJ,OU=Employees,OU=Company_Users,DC=company,DC=com"
  },
  "details_bookstack_parsed": {
    "uid": "CN=DoeJ,OU=Employees,OU=Company_Users,DC=company,DC=com",
    "name": "John",
    "dn": "CN=DoeJ,OU=Employees,OU=Company_Users,DC=company,DC=com",
    "email": "John.Doe@company.com",
    "avatar": "????\u0000...\u0000"
  }
}
@Tomblarom commented on GitHub (Jul 22, 2025): Hey @ssddanbrown, thanks for your reply. Here is the (censored) output: ``` { "details_from_ldap": { "cn": { "count": 1, "0": "DoeJ" }, "0": "cn", "givenname": { "count": 1, "0": "John" }, "1": "givenname", "mail": { "count": 1, "0": "John.Doe@company.com" }, "2": "mail", "jpegphoto": { "count": 1, "0": "????\u0000...\u0000" }, "3": "jpegphoto", "count": 4, "dn": "CN=DoeJ,OU=Employees,OU=Company_Users,DC=company,DC=com" }, "details_bookstack_parsed": { "uid": "CN=DoeJ,OU=Employees,OU=Company_Users,DC=company,DC=com", "name": "John", "dn": "CN=DoeJ,OU=Employees,OU=Company_Users,DC=company,DC=com", "email": "John.Doe@company.com", "avatar": "????\u0000...\u0000" } } ```
Author
Owner

@watschi commented on GitHub (Jul 23, 2025):

Hi @Tomblarom

I think the surname attribute in AD is just called sn, so I'd give LDAP_DISPLAY_NAME_ATTRIBUTE=givenName|sn a try.
The AD output in your initial post is probably from PowerShell and the AD Module, which returns "display names" for some attribute keys, which cannot be requested by other applications.

@watschi commented on GitHub (Jul 23, 2025): Hi @Tomblarom I think the surname attribute in AD is just called `sn`, so I'd give `LDAP_DISPLAY_NAME_ATTRIBUTE=givenName|sn` a try. The AD output in your initial post is probably from PowerShell and the AD Module, which returns "display names" for some attribute keys, which cannot be requested by other applications.
Author
Owner

@Tomblarom commented on GitHub (Jul 23, 2025):

@watschi I can confirm, that using LDAP_DISPLAY_NAME_ATTRIBUTE=givenName|sn solved it! :)

@Tomblarom commented on GitHub (Jul 23, 2025): @watschi I can confirm, that using `LDAP_DISPLAY_NAME_ATTRIBUTE=givenName|sn` solved it! :)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#5373