An IP based authentication passport strategy.
npm i eugeniop/passport-ip --save
Register the strategy in passport as follows:
var passport = require('passport');
var IpStrategy = require('passport-ip').Strategy;
passport.use(new IpStrategy({
range: '10.0.0.0/8'
}, function(profile, done){
done(null, profile);
//profile.id is the ip address.
}));
If you are running your express application behind a proxy that you trust:
app.enable('trust proxy');
Then passport-ip will use the X-Forwarded-For header.
MIT 2014 Eugenio Pace