I'm trying to create a rest service which would authenticate a user with their username and password.
The data provided to me for doing it is (data is example, not what I actually got): -host: 10.10.10.10 -port: 443 -attribute: uid -base: dc=example, dc=corp -admin_user: "cn=ex,ou=applications,dc=example,dc=corp" -admin_password: "example123"
What I've tried is using node.js with passport-ldapauth with the following code:
const express = require('express')
const app = express();
const port = 443;
var passport = require('passport');
const LdapStrategy = require('passport-ldapauth');
const bodyParser = require('body-parser');
const OPTS = {
server: {
url: 'LDAP://10.10.10.10/dc=example, dc=corp',
port: 443,
bindDN: 'dc=example, dc=corp'
}
};
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'});
});
app.listen(port, () =>{
console.log('Listening');
})
But I'm not even receving a response from the server with postman calling to http://localhost/login with username and password passed as json or urlencoded, I don't know if the problem is in my side or on server side.
Any help will be much appreciated.