@ilb/node_ldap
Advanced tools
Comparing version 1.1.0 to 1.1.1
{ | ||
"name": "@ilb/node_ldap", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "author": "github@iconicompany.com", |
@@ -8,17 +8,26 @@ const { existsSync, readFileSync } = require('fs'); | ||
const createDebug = require('debug'); | ||
const { getLdapConfPath } = require('./defaults.js'); | ||
const debug = createDebug('node_ldap'); | ||
/** | ||
* LDAP facade with auto-configuration | ||
*/ | ||
function LDAPFactory(ldapConfPath = '/etc/openldap/ldap.conf') { | ||
function LDAPFactory(ldapConfPath) { | ||
this.ldapConfig = null; | ||
if (process.env.LDAP_URL) { | ||
//configure using LDAP_URL variable if set | ||
this.ldapConfig = new URILDAPConfig(process.env.LDAP_URL, process.env.NODE_EXTRA_CA_CERTS); | ||
debug('configured using LDAP_URL', this.ldapConfig); | ||
} else if (existsSync(ldapConfPath)) { | ||
//configure using openldap configuration file | ||
this.ldapConfig = new OpenLDAPConfig(readFileSync(ldapConfPath, 'utf8')); | ||
debug('configured using ldap config file', ldapConfPath, this.ldapConfig); | ||
if (process.env.LDAPURI) { | ||
//configure using LDAPURI variable if set | ||
this.ldapConfig = new URILDAPConfig( | ||
process.env.LDAPURI, | ||
process.env.LDAPBASE, | ||
process.env.LDAPTLS_CACERT | ||
); | ||
debug('configured using LDAPURI', this.ldapConfig); | ||
} else { | ||
ldapConfPath = ldapConfPath || getLdapConfPath(); | ||
if (ldapConfPath && existsSync(ldapConfPath)) { | ||
//configure using openldap configuration file | ||
this.ldapConfig = new OpenLDAPConfig(readFileSync(ldapConfPath, 'utf8')); | ||
debug('configured using ldap config file', ldapConfPath, this.ldapConfig); | ||
} | ||
} | ||
@@ -25,0 +34,0 @@ this.ldapClientFactory = new LDAPClientFactory(); |
@@ -5,5 +5,5 @@ /** | ||
*/ | ||
function URILDAPConfig(uri, caCert) { | ||
function URILDAPConfig(uri, base, caCert) { | ||
const urlobj = new URL(uri); | ||
this.base = urlobj.pathname.substring(1); | ||
this.base = base || urlobj.pathname.substring(1); | ||
urlobj.pathname = ''; | ||
@@ -10,0 +10,0 @@ this.uri = [urlobj.toString()]; |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances 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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
9642
12
293
10