Skip to content

LDAP auth not working #31

Description

@aswanthvp

i have older passport and passport-ldap package with that authentication is working and when installed the latest package authentication is not happening its giving Unauthorized as output.
this is my code:

`
var express = require('express'),
passport = require('passport'),
bodyParser = require('body-parser'),
LdapStrategy = require('passport-ldapauth');

process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
var OPTS = {
server: {
url: "ldaps://--------------"
bindDn: 'ZGN',
bindCredentials: 'password',
searchBase: 'DC=---------,DC=-----',
searchFilter: '(samaccountName={{username}})',
searchAttributes: ["displayName", "givenName", "mail", "title", "telephoneNumber", "samaccountname", "userPrincipalName"],
}
// ,
// usernameField: 'username',
// passwordField: 'password'
};

var app = express();

passport.use(new LdapStrategy(OPTS));

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: false}));
app.use(passport.initialize());

app.post('/login', passport.authenticate('ldapauth', {session: false}), function(req, res) {
res.send({status: 'ok'});
});
//API call with parameter
// {
// "username":"coreid",
// "password":"password"
// }

app.listen(8080);
`

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions