auth0 / passport-windowsauth

Windows Authentication strategy for Passport.js
MIT License
178 stars 54 forks source link

Not able to make it work with koajs #26

Open skeep opened 9 years ago

skeep commented 9 years ago

I am not able to make it work with koajs.

Below are the relevant code.

in app.js

public.post('/login', function * (next) {
        passport.authenticate('WindowsAuthentication', {
            successRedirect: '/succ',
            failureRedirect: '/fail',
            failureFlash: true
        });
    });

in auth.js

(function() {
    var passport = require('koa-passport'),
        WindowsStrategy = require('passport-windowsauth');

    passport.serializeUser(function(user, done) {
        done(null, user);
    });
    passport.deserializeUser(function(user, done) {
        done(null, user);
    });

    passport.use(new WindowsStrategy({
        ldap: {
            url: 'ldap://ads.hhh.com',
            base: 'dc=ads,dc=,dc=com',
            bindDN: '_app',
            bindCredentials: ''
        },
        integrated: false
    }, function(profile, done) {
        console.log('auth');
        if (profile) {
            console.log(profile);
            done(null, profile.name);
        } else
            done('Not authorized', null);
    }));
})();

I referred to this example and the LocalStrategy did work. But when I submit the login form with "Windows Strategy" enabled it gives below output. screen shot 2015-06-19 at 2 34 14 pm Whereas I expect it to either go to /succ or /fail .

BTW when I run the program without the firewall I do get below message which makes me think that it is trying to access the server. screen shot 2015-06-19 at 2 37 00 pm

I am actually not sure if the problem is with the module or my implementation. But still thought of asking.

Any direction will be much appreciated.