Skip to content

UlisesGascon/basic-auth-connect

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Basic auth middleware for node and connect

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 98.2%
  • Makefile 1.8%