basic-auth-connect
Basic auth middleware for node and connect
Last updated 2 years ago by ulisesgascon .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install basic-auth-connect 
SYNC missed versions from official npm registry.

basic-auth-connect

Connect's Basic Auth middleware in its own module. You should consider to create your own middleware with basic-auth.

API

var basicAuth = require('basic-auth-connect');

Simple username and password

connect()
.use(basicAuth('username', 'password'));

Callback verification

connect()
.use(basicAuth(function(user, pass){
  return 'tj' == user && 'wahoo' == pass;
}))

Async callback verification, accepting fn(err, user).

connect()
.use(basicAuth(function(user, pass, fn){
  User.authenticate({ user: user, pass: pass }, fn);
}))

Security Considerations

Important: When using the callback method, it is recommended to use a time-safe comparison function like crypto.timingSafeEqual to prevent timing attacks.

License

MIT

Current Tags

  • 1.1.0                                ...           latest (2 years ago)

2 Versions

  • 1.1.0                                ...           2 years ago
  • 1.0.0                                ...           13 years ago
Downloads
Total 4
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 1
Last Month 0
Dependencies (1)
Dev Dependencies (4)

© 2010 - cnpmjs.org x YWFE | Home | YWFE