From 95ac4a2dc8b0a301f4450849ea3bc59e303b4fd0 Mon Sep 17 00:00:00 2001 From: John Redwood Date: Sun, 24 Nov 2024 11:41:58 +1100 Subject: [PATCH] fix: eslint Signed-off-by: John Redwood --- .changeset/weak-avocados-suffer.md | 5 +++++ plugins/catalog-backend-module-ldap/src/ldap/client.ts | 3 +++ .../catalog-backend-module-ldap/src/ldap/vendors.ts | 10 ++++++++++ 3 files changed, 18 insertions(+) create mode 100644 .changeset/weak-avocados-suffer.md diff --git a/.changeset/weak-avocados-suffer.md b/.changeset/weak-avocados-suffer.md new file mode 100644 index 0000000000..01142aa927 --- /dev/null +++ b/.changeset/weak-avocados-suffer.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-backend-module-ldap': minor +--- + +Add new ldap vendor config 'LLDAP' diff --git a/plugins/catalog-backend-module-ldap/src/ldap/client.ts b/plugins/catalog-backend-module-ldap/src/ldap/client.ts index 61dd05f437..ac0be476d5 100644 --- a/plugins/catalog-backend-module-ldap/src/ldap/client.ts +++ b/plugins/catalog-backend-module-ldap/src/ldap/client.ts @@ -26,6 +26,7 @@ import { ActiveDirectoryVendor, DefaultLdapVendor, GoogleLdapVendor, + LLDAPVendor, FreeIpaVendor, LdapVendor, } from './vendors'; @@ -248,6 +249,8 @@ export class LdapClient { return AEDirVendor; } else if (clientHost === 'ldap.google.com') { return GoogleLdapVendor; + } else if (root && root.raw?.vendorName?.toString() === 'LLDAP') { + return LLDAPVendor; } return DefaultLdapVendor; }) diff --git a/plugins/catalog-backend-module-ldap/src/ldap/vendors.ts b/plugins/catalog-backend-module-ldap/src/ldap/vendors.ts index 3afec59114..872941608d 100644 --- a/plugins/catalog-backend-module-ldap/src/ldap/vendors.ts +++ b/plugins/catalog-backend-module-ldap/src/ldap/vendors.ts @@ -94,6 +94,16 @@ export const GoogleLdapVendor: LdapVendor = { }, }; +export const LLDAPVendor: LdapVendor = { + dnAttributeName: 'dn', + uuidAttributeName: 'entryuuid', + decodeStringAttribute: (entry, name) => { + return decode(entry, name.toLocaleLowerCase('en-US'), value => { + return value.toString(); + }); + }, +}; + // Decode an attribute to a consumer function decode( entry: SearchEntry,