Merge pull request #27373 from megatroom/master

Add Support for Google LDAP Vendor
This commit is contained in:
Patrik Oldsberg
2024-11-05 13:18:20 +01:00
committed by GitHub
3 changed files with 19 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend-module-ldap': minor
---
Add Support for Google LDAP Vendor
@@ -25,6 +25,7 @@ import {
AEDirVendor,
ActiveDirectoryVendor,
DefaultLdapVendor,
GoogleLdapVendor,
FreeIpaVendor,
LdapVendor,
} from './vendors';
@@ -236,6 +237,7 @@ export class LdapClient {
if (this.vendor) {
return this.vendor;
}
const clientHost = this.client?.host || '';
this.vendor = this.getRootDSE()
.then(root => {
if (root && root.raw?.forestFunctionality) {
@@ -244,6 +246,8 @@ export class LdapClient {
return FreeIpaVendor;
} else if (root && 'aeRoot' in root.raw) {
return AEDirVendor;
} else if (clientHost === 'ldap.google.com') {
return GoogleLdapVendor;
}
return DefaultLdapVendor;
})
@@ -89,6 +89,16 @@ export const AEDirVendor: LdapVendor = {
},
};
export const GoogleLdapVendor: LdapVendor = {
dnAttributeName: 'dn',
uuidAttributeName: 'uid',
decodeStringAttribute: (entry, name) => {
return decode(entry, name, value => {
return value.toString();
});
},
};
// Decode an attribute to a consumer
function decode(
entry: SearchEntry,