Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.
This repository was archived by the owner on May 14, 2024. It is now read-only.

LDAPJS Server: when searching, I need to request in lowercase attributes in order to get mixed-case attributes #974

@mgx0

Description

@mgx0

i have a function that generates LDAP User object from data received from Keycloak and sends it via search response. commented are problematic:

const fabricatedObject = {
      dn: 'uid=' + keycloakUser.username + ',ou=' + keycloakUser.attributes.ou + ',o=organization',
      attributes: {
        objectClass: ['person', 'top', 'organizationalPerson', 'inetOrgPerson', 'posixAccount'], // PROBLEMATIC
        cn: keycloakUser.firstName + ' ' + keycloakUser.lastName,
        displayName: keycloakUser.firstName + ' ' + keycloakUser.lastName, // PROBLEMATIC
        givenName: keycloakUser.firstName, // PROBLEMATIC
        sn: keycloakUser.lastName,
        ou: (keycloakUser.attributes.ou || "none"),
        mail: keycloakUser.email.toString(),
        uid: keycloakUser.username.toString(),
        entryUUID: keycloakUser.attributes.LDAP_ID || keycloakUser.id, // PROBLEMATIC
        keycloakId: keycloakUser.id.toString(), // PROBLEMATIC
        ldapId: (keycloakUser.attributes.LDAP_ID || "none").toString() // PROBLEMATIC
      },

this does not return entryUUID nor ldapId (applies for all bold marked above):
ldapsearch -H ldap://localhost:10389 -x -b o=organization -D BINDUSER -w BINDPASS "(uid=*)" "mail" "entryUUID" "ldapId"

but this does (and mixed-case entryUUID and ldapId is received:
ldapsearch -H ldap://localhost:10389 -x -b o=organization -D BINDUSER -w BINDPASS "(uid=*)" "mail" "entryuuid" "ldapid"

the point is, that specifying exact case of "entryUUID" is wrong. I have to ask for lowercase "entryuuid" in order to receive attribute "entryUUID" with it's value

this is easily fixable, can I offer a quick PR for this? I believe it's not intended behaviour, as clients shall be able to use upper or lowercase attribute names.
LDAP Attributes are case insensitive, so I believe searching for "ENTRYUUID", "entryuuid" and "entryUUID" shall always return the entryUUID that's defined in the generator function above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions