Ldap styling
This commit is contained in:
parent
e85121a9d6
commit
5396b27ffa
@ -1,5 +1,5 @@
|
|||||||
const LdapAuth = require('ldapauth-fork')
|
const LdapAuth = require('ldapauth-fork')
|
||||||
const fs = require('fs');
|
const fs = require('fs')
|
||||||
|
|
||||||
const store = {
|
const store = {
|
||||||
weight: 100
|
weight: 100
|
||||||
@ -177,7 +177,7 @@ async function login (peertubeHelpers, settingsManager, options) {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
let clientOpts = {
|
const clientOpts = {
|
||||||
url: settings['url'],
|
url: settings['url'],
|
||||||
bindDN: settings['bind-dn'],
|
bindDN: settings['bind-dn'],
|
||||||
bindCredentials: settings['bind-credentials'],
|
bindCredentials: settings['bind-credentials'],
|
||||||
@ -189,17 +189,17 @@ async function login (peertubeHelpers, settingsManager, options) {
|
|||||||
tlsOptions: {
|
tlsOptions: {
|
||||||
rejectUnauthorized: settings['insecure-tls'] !== true
|
rejectUnauthorized: settings['insecure-tls'] !== true
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
if (settings['custom-ca'] && settings['insecure-tls'] !== true) {
|
if (settings['custom-ca'] && settings['insecure-tls'] !== true) {
|
||||||
try {
|
try {
|
||||||
let cadata = fs.readFileSync(settings['custom-ca']);
|
clientOpts.tlsOptions['ca'] = [ await fs.readFile(settings['custom-ca']) ]
|
||||||
clientOpts.tlsOptions['ca'] = [ cadata ];
|
} catch (err) {
|
||||||
} catch (nvm) {
|
logger.warn('Could not load custom CA in LDAP plugin', { err })
|
||||||
logger.warn('Could not load custom CA in LDAP plugin', { nvm });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const ldapClient = new LdapAuth(clientOpts);
|
const ldapClient = new LdapAuth(clientOpts)
|
||||||
|
|
||||||
return new Promise(res => {
|
return new Promise(res => {
|
||||||
function onError (err) {
|
function onError (err) {
|
||||||
|
Loading…
Reference in New Issue
Block a user