You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by jx...@apache.org on 2018/08/18 00:20:11 UTC
[11/14] helix git commit: use ldapjs lib instead of ldap-client
use ldapjs lib instead of ldap-client
Project: http://git-wip-us.apache.org/repos/asf/helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/5f248c3d
Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/5f248c3d
Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/5f248c3d
Branch: refs/heads/master
Commit: 5f248c3d0b823c59ffc7855e291eedf62b2d5a6f
Parents: d60d51b
Author: Vivo Xu <vx...@linkedin.com>
Authored: Tue Apr 3 12:57:22 2018 -0700
Committer: Vivo Xu <vx...@linkedin.com>
Committed: Wed Aug 8 15:42:11 2018 -0700
----------------------------------------------------------------------
helix-front/package.json | 2 +-
helix-front/server/controllers/user.ts | 14 +++-----------
2 files changed, 4 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/helix/blob/5f248c3d/helix-front/package.json
----------------------------------------------------------------------
diff --git a/helix-front/package.json b/helix-front/package.json
index 844980b..b52563b 100644
--- a/helix-front/package.json
+++ b/helix-front/package.json
@@ -44,7 +44,7 @@
"express": "^4.15.3",
"express-session": "^1.15.6",
"hammerjs": "^2.0.8",
- "ldap-client": "^3.1.3",
+ "ldapjs": "^1.0.2",
"lodash": "^4.17.4",
"moment": "^2.22.2",
"morgan": "^1.8.2",
http://git-wip-us.apache.org/repos/asf/helix/blob/5f248c3d/helix-front/server/controllers/user.ts
----------------------------------------------------------------------
diff --git a/helix-front/server/controllers/user.ts b/helix-front/server/controllers/user.ts
index 609b9f8..1cd5288 100644
--- a/helix-front/server/controllers/user.ts
+++ b/helix-front/server/controllers/user.ts
@@ -1,7 +1,7 @@
import { Request, Response, Router } from 'express';
import * as request from 'request';
-import * as LdapClient from 'ldap-client';
+import * as LdapClient from 'ldapjs';
import { LDAP, CheckAdmin } from '../config';
@@ -48,16 +48,8 @@ export class UserCtrl {
}
// check LDAP
- const ldap = new LdapClient({ uri: LDAP.uri, base: LDAP.base }, err => {
- if (err) {
- res.status(500).json(err);
- }
- });
-
- ldap.bind({
- binddn: credential.username + LDAP.principalSuffix,
- password: credential.password
- }, err => {
+ const ldap = LdapClient.createClient({ url: LDAP.uri });
+ ldap.bind(credential.username + LDAP.principalSuffix, credential.password, err => {
if (err) {
res.status(401).json(false);
} else {