Add LDAPS-support to LDAP-Authcontroller (#7014)
* Add LDAPS-support to LDAP-Authcontroller * Add Testcase that failed with valid certificate but wrong credendtials to LDAP-Authcontroller * change scope of 'error' and remove 'case undefined', because it's not needed anymore
This commit is contained in:
committed by
GitHub
parent
ccb045b68c
commit
c958c46fa7
@@ -1,7 +1,13 @@
|
||||
const ldapjs = require('ldapjs');
|
||||
const fs = require('fs');
|
||||
|
||||
function newServer(port, dn, provokeSearchError = false) {
|
||||
const server = ldapjs.createServer();
|
||||
const tlsOptions = {
|
||||
key: fs.readFileSync(__dirname + '/support/cert/key.pem'),
|
||||
certificate: fs.readFileSync(__dirname + '/support/cert/cert.pem')
|
||||
}
|
||||
|
||||
function newServer(port, dn, provokeSearchError = false, ssl = false) {
|
||||
const server = ssl ? ldapjs.createServer(tlsOptions) : ldapjs.createServer();
|
||||
|
||||
server.bind('o=example', function (req, res, next) {
|
||||
if (req.dn.toString() !== dn || req.credentials !== 'secret')
|
||||
|
||||
Reference in New Issue
Block a user