passport-ip

0.1.2 • Public • Published

An IP based authentication passport strategy.

This repository was forked from https://github.com/eugeniop/passport-ip and modified slightly.

Installation

npm i passport-ip --save

Usage

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.
}));

Configuration behind a proxy

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.

License

MIT 2016 Anthony Liatsis

Package Sidebar

Install

npm i passport-ip

Weekly Downloads

2

Version

0.1.2

License

none

Last publish

Collaborators

  • anthonyl