From 216fd3e33c2d27e1160c8be64379921fe16e8ca8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20de=20CHAVIGNY?= Date: Sun, 4 Sep 2022 16:42:32 -0400 Subject: [PATCH] new ad ldap datasource with ldapts --- packages/server/src/integrations/adldap.ts | 23 +++++++--------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/packages/server/src/integrations/adldap.ts b/packages/server/src/integrations/adldap.ts index f246b1b93..37384653b 100644 --- a/packages/server/src/integrations/adldap.ts +++ b/packages/server/src/integrations/adldap.ts @@ -100,9 +100,9 @@ module AdLdapModule { url: this.config.url, timeout: 0, connectTimeout: 0, - tlsOptions: { + /*tlsOptions: { minVersion: 'TLSv1.2', - }, + },*/ strictDN: true, }) } @@ -156,32 +156,23 @@ module AdLdapModule { } else { console.log("Client ldap Non connecté") } + var response; try { await this.client.bind(this.config.bindDN, this.config.secret) const { searchEntries, searchReferences } = await this.client.search(this.config.baseDN, { scope: 'sub', - filter: '(mail=herve.dechavigny@cacem.fr)', + filter: (query.bucket=='')?'(&(objectCategory=person)(objectClass=user)(mail=*)(sAMAccountName=*))':`${query.bucket}`, }) + response = searchEntries } catch (ex) { throw ex; } finally { await this.client.unbind() } - /*const response = await this.client.queryAttributes({ - attributes: [`${query.bucket}`], - options: { - filter:"(&(|(objectClass=user)(objectClass=person))(!(objectClass=computer))(!(objectClass=group)))", - scope: "sub", - paged: false - }, - base:this.config.baseDN - - });*/ - const response = { result:'test'} + console.log("Ldap users :",response) - // always free-Up after you done the job! - this.client.unbind(); + return response }) }