ldap-ts-client
Advanced tools
Comparing version 0.8.0 to 0.9.0
@@ -9,5 +9,5 @@ "use strict"; | ||
const options = { | ||
url: (_a = process.env.AD_URI) !== null && _a !== void 0 ? _a : "", | ||
bindDN: (_b = process.env.AD_USER) !== null && _b !== void 0 ? _b : "", | ||
secret: (_c = process.env.AD_Pass) !== null && _c !== void 0 ? _c : "", | ||
ldapServerUrl: (_a = process.env.AD_URI) !== null && _a !== void 0 ? _a : "", | ||
user: (_b = process.env.AD_USER) !== null && _b !== void 0 ? _b : "", | ||
pass: (_c = process.env.AD_Pass) !== null && _c !== void 0 ? _c : "", | ||
baseDN: "DC=ki,DC=local", | ||
@@ -14,0 +14,0 @@ }; |
import ldap, { SearchOptions, Control, SearchEntryObject } from "ldapjs"; | ||
import type { Logger } from "pino"; | ||
export interface IClientConfig extends ldap.ClientOptions { | ||
export interface IClientConfig extends Omit<ldap.ClientOptions, "url" | "bindDN"> { | ||
/**Password to connect to AD */ | ||
secret: string; | ||
pass: string; | ||
/**User to connect to AD */ | ||
bindDN: string; | ||
user: string; | ||
/**Root of tree for search */ | ||
baseDN: string; | ||
/** Domain name with format: ldap://{domain.com} */ | ||
url: string; | ||
ldapServerUrl: string; | ||
/**instance of pino logger */ | ||
@@ -13,0 +13,0 @@ logger?: Logger; |
@@ -17,3 +17,6 @@ "use strict"; | ||
this.baseDN = config.baseDN; | ||
this.client = ldapjs_1.default.createClient(Object.assign(Object.assign({}, this.config), { log: this.config.logger })); | ||
this.client = ldapjs_1.default.createClient({ | ||
url: config.ldapServerUrl, | ||
log: this.config.logger, | ||
}); | ||
} | ||
@@ -25,3 +28,3 @@ /** @return a connected ldap client that is useful for use flexibility of [ldap.js](http://ldapjs.org/) directly. */ | ||
return new Promise((resolve, reject) => { | ||
this.client.bind(this.config.bindDN, this.config.secret, (err) => { | ||
this.client.bind(this.config.user, this.config.pass, (err) => { | ||
if (err) { | ||
@@ -28,0 +31,0 @@ reject(err); |
{ | ||
"name": "ldap-ts-client", | ||
"version": "0.8.0", | ||
"version": "0.9.0", | ||
"description": "Type-safe LDAP client written in typescript", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -8,5 +8,5 @@ import { config } from "dotenv"; | ||
const options: IClientConfig = { | ||
url: process.env.AD_URI ?? "", | ||
bindDN: process.env.AD_USER ?? "", | ||
secret: process.env.AD_Pass ?? "", | ||
ldapServerUrl: process.env.AD_URI ?? "", | ||
user: process.env.AD_USER ?? "", | ||
pass: process.env.AD_Pass ?? "", | ||
baseDN: "DC=ki,DC=local", | ||
@@ -13,0 +13,0 @@ }; |
@@ -5,11 +5,12 @@ import ldap, { SearchOptions, Control, SearchEntryObject } from "ldapjs"; | ||
export interface IClientConfig extends ldap.ClientOptions { | ||
export interface IClientConfig | ||
extends Omit<ldap.ClientOptions, "url" | "bindDN"> { | ||
/**Password to connect to AD */ | ||
secret: string; | ||
pass: string; | ||
/**User to connect to AD */ | ||
bindDN: string; | ||
user: string; | ||
/**Root of tree for search */ | ||
baseDN: string; | ||
/** Domain name with format: ldap://{domain.com} */ | ||
url: string; | ||
ldapServerUrl: string; | ||
/**instance of pino logger */ | ||
@@ -86,3 +87,3 @@ logger?: Logger; | ||
this.client = ldap.createClient({ | ||
...this.config, | ||
url: config.ldapServerUrl, | ||
log: this.config.logger, | ||
@@ -101,3 +102,3 @@ }); | ||
return new Promise((resolve, reject) => { | ||
this.client.bind(this.config.bindDN, this.config.secret, (err) => { | ||
this.client.bind(this.config.user, this.config.pass, (err) => { | ||
if (err) { | ||
@@ -104,0 +105,0 @@ reject(err); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
56984
1107