fix(ldap): preserve the directory-provided bind DN (#1486)

This commit is contained in:
ZacharyZcR authored and GitHub committed 2026-09-27 00:51:18 -05:00
1 parent 4897024324
commit 378be3405a
2 files changed
+37 -8

No files matched your search

+4 -1
View File
@@ -141,12 +141,15 @@ export function createLdapLogin(ctx: PluginContext, store: ProviderStore) {
config.displayNameAttribute || "cn",
"mail",
"email",
"distinguishedName",
],
);
if (entries.length === 0) throw await refuse("user not found");
const userEntry = entries[0];
const userDN = userEntry.dn.toString();
// AD supplies its DN as an attribute; avoid re-serializing it through ldapjs.
const userDN =
firstValue(userEntry, "distinguishedName") || userEntry.dn.toString();
const uid =
firstValue(userEntry, config.usernameAttribute || "uid") || username;
const displayName =