From ccbcb758f0a71e3bcf897afa90aef52d73afc96e Mon Sep 17 00:00:00 2001 From: Clement Michaud Date: Sun, 18 Dec 2016 01:49:09 +0100 Subject: [PATCH] Reconnect to LDAP when connection is closed (or not open at the beginning) --- .gitignore | 1 + Dockerfile | 1 - src/index.js | 4 ++-- src/lib/authentication.js | 1 - src/lib/routes.js | 1 - test/integration/test_server.js | 3 +++ 6 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 0f57c731..924d1e3a 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ coverage/ *.swp +*.sh diff --git a/Dockerfile b/Dockerfile index c7facd66..9148430c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,5 +7,4 @@ RUN npm install COPY src /usr/src - CMD ["node", "index.js"] diff --git a/src/index.js b/src/index.js index 9bafddaf..1616cde7 100644 --- a/src/index.js +++ b/src/index.js @@ -13,8 +13,8 @@ var config = { } var ldap_client = ldap.createClient({ - url: config.ldap_url + url: config.ldap_url, + reconnect: true }); server.run(config, ldap_client); - diff --git a/src/lib/authentication.js b/src/lib/authentication.js index 60612aec..cf8e66f1 100644 --- a/src/lib/authentication.js +++ b/src/lib/authentication.js @@ -49,7 +49,6 @@ function authenticate(req, res) { function verify_authentication(req, res) { console.log('Verify authentication'); - console.log(req.cookies); if(!objectPath.has(req, 'cookies.access_token')) { return utils.reject('No access token provided'); diff --git a/src/lib/routes.js b/src/lib/routes.js index ccec7e38..49120c9a 100644 --- a/src/lib/routes.js +++ b/src/lib/routes.js @@ -33,7 +33,6 @@ function serveAuthPost(req, res) { } function serveLogin(req, res) { - console.log(req.headers); res.render('login'); } diff --git a/test/integration/test_server.js b/test/integration/test_server.js index 7fd86a34..d02139c6 100644 --- a/test/integration/test_server.js +++ b/test/integration/test_server.js @@ -107,6 +107,9 @@ describe('test the server', function() { (content.indexOf('This is a very important secret!') > -1); assert(is_secret_page_content); done(); + }) + .fail(function(err) { + console.error(err); }); });