@ilb/node_ldap
Advanced tools
Comparing version 1.0.11 to 1.0.12
{ | ||
"name": "@ilb/node_ldap", | ||
"version": "1.0.11", | ||
"version": "1.0.12", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "author": "github@bystrobank.ru", |
@@ -10,2 +10,9 @@ /** | ||
} | ||
/** | ||
* check if this instance if configured | ||
*/ | ||
isConfigured() { | ||
return this.uri && this.uri.length > 0; | ||
} | ||
} |
@@ -13,2 +13,3 @@ import { existsSync, readFileSync } from 'fs'; | ||
constructor(ldapConfPath = '/etc/openldap/ldap.conf') { | ||
this.ldapConfig = null; | ||
if (process.env.LDAP_URL) { | ||
@@ -20,10 +21,3 @@ //configure using LDAP_URL variable if set | ||
this.ldapConfig = new OpenLDAPConfig(readFileSync(ldapConfPath, 'utf8')); | ||
} else { | ||
throw new Error( | ||
'Ldap client auto-configuration failed: LDAP_URL environment variable OR file ' + | ||
ldapConfPath + | ||
' required.' | ||
); | ||
} | ||
this.ldapClientConfig = new LDAPClientConfig(this.ldapConfig); | ||
this.ldapClientFactory = new LDAPClientFactory(); | ||
@@ -34,2 +28,8 @@ this.ldapClient = null; | ||
/** | ||
* check if ldapFactory configured | ||
*/ | ||
isConfigured() { | ||
return !!(this.ldapConfig && this.ldapConfig.isConfigured()); | ||
} | ||
/** | ||
* lazy-initalization method to get ldapClient | ||
@@ -39,3 +39,4 @@ */ | ||
if (this.ldapClient === null) { | ||
this.ldapClient = this.ldapClientFactory.getLDAPClient(this.ldapClientConfig); | ||
const ldapClientConfig = new LDAPClientConfig(this.ldapConfig); | ||
this.ldapClient = this.ldapClientFactory.getLDAPClient(ldapClientConfig); | ||
} | ||
@@ -42,0 +43,0 @@ return this.ldapClient; |
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
8989
278