diff --git a/plugins/catalog-backend-module-ldap/api-report.md b/plugins/catalog-backend-module-ldap/api-report.md index edeef4cb82..3c6cd4849b 100644 --- a/plugins/catalog-backend-module-ldap/api-report.md +++ b/plugins/catalog-backend-module-ldap/api-report.md @@ -134,7 +134,7 @@ export class LdapOrgReaderProcessor implements CatalogProcessor { }); // (undocumented) static fromConfig( - config: Config, + configRoot: Config, options: { logger: Logger; groupTransformer?: GroupTransformer; diff --git a/plugins/catalog-backend-module-ldap/src/processors/LdapOrgEntityProvider.ts b/plugins/catalog-backend-module-ldap/src/processors/LdapOrgEntityProvider.ts index bad3941767..b31b7ae266 100644 --- a/plugins/catalog-backend-module-ldap/src/processors/LdapOrgEntityProvider.ts +++ b/plugins/catalog-backend-module-ldap/src/processors/LdapOrgEntityProvider.ts @@ -114,17 +114,11 @@ export class LdapOrgEntityProvider implements EntityProvider { const config = configRoot.getOptionalConfig('ldap') || configRoot.getOptionalConfig('catalog.processors.ldapOrg'); - if (!config) { - throw new TypeError( - `There is no LDAP configuration. Please add it as "ldap.providers".`, - ); - } - - const providers = readLdapConfig(config); + const providers = config ? readLdapConfig(config) : []; const provider = providers.find(p => options.target === p.target); if (!provider) { throw new TypeError( - `There is no LDAP configuration that matches ${options.target}. Please add a configuration entry for it under "ldap.providers".`, + `There is no LDAP configuration that matches "${options.target}". Please add a configuration entry for it under "ldap.providers".`, ); } diff --git a/plugins/catalog-backend-module-ldap/src/processors/LdapOrgReaderProcessor.ts b/plugins/catalog-backend-module-ldap/src/processors/LdapOrgReaderProcessor.ts index 8cfc92eff1..74a7e153b9 100644 --- a/plugins/catalog-backend-module-ldap/src/processors/LdapOrgReaderProcessor.ts +++ b/plugins/catalog-backend-module-ldap/src/processors/LdapOrgReaderProcessor.ts @@ -54,15 +54,9 @@ export class LdapOrgReaderProcessor implements CatalogProcessor { const config = configRoot.getOptionalConfig('ldap') || configRoot.getOptionalConfig('catalog.processors.ldapOrg'); - if (!config) { - throw new TypeError( - `There is no LDAP configuration. Please add it as "ldap.providers".`, - ); - } - return new LdapOrgReaderProcessor({ ...options, - providers: readLdapConfig(config), + providers: config ? readLdapConfig(config) : [], }); } @@ -94,7 +88,7 @@ export class LdapOrgReaderProcessor implements CatalogProcessor { const provider = this.providers.find(p => location.target === p.target); if (!provider) { throw new Error( - `There is no LDAP Org provider that matches ${location.target}. Please add a configuration entry for it under catalog.processors.ldapOrg.providers.`, + `There is no LDAP configuration that matches "${location.target}". Please add a configuration entry for it under "ldap.providers".`, ); }