Allow connecting to SSL-secured servers with self-signed certificates

Adds a new configuration parameter ('check_certificate'),
which gets wired up to the rejectUnauthorized option of
tls.connect.
This commit is contained in:
Will Rigby 2015-04-16 00:25:55 -04:00
parent 82e2a19749
commit 0966ba909b

View File

@ -26,7 +26,8 @@ class AuthLdap {
constructor (conf) {
const clientOpts = {
url: conf.uri,
maxConnections: 5
maxConnections: 5,
tlsOptions: { }
}
{
@ -37,6 +38,10 @@ class AuthLdap {
}
}
if (conf.check_certificate !== undefined) {
clientOpts.tlsOptions.rejectUnauthorized = conf.check_certificate
}
const {base: searchBase} = conf
const searchFilter = conf.filter || '(uid={{name}})'