Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
passport-local-htpasswd
Advanced tools
Local username and password authentication strategy for Passport.
A passport strategy for using bcrypted htpasswd files. This behaves virtually identically to passport-local, except that simply specifying a htpasswd is enough to provide basic authentication. As these files contain no user information, you are on your own with that.
This isn't intended as a full production model for authentication. However, it doesn't require a database and provides a basic and reasonably secure authentication system with the simplicity of maintenance from the htpasswd command.
Significant portions of this module were derived from passport-local
by
Jared Hanson.
The module works with htpasswd files created using bcrypt only. For example, to create a password file, use a command like this:
htpasswd -c -B .htpasswd myuser
The local authentication strategy authenticates users using a username and
password. The strategy requires a verify
callback, which accepts these
credentials and calls done
providing a user.
passport.use(new LocalHtpasswdStrategy({file: filename});
Use passport.authenticate()
, specifying the 'local-htpasswd'
strategy, to
authenticate requests.
For example, as route middleware in an Express application:
app.post('/login',
passport.authenticate('local-htpasswd', { failureRedirect: '/login' }),
function(req, res) {
res.redirect('/');
});
The module doesn't store or persist users. The user is made available as an
object with a single property username
with the given username.
FAQs
Local username and password authentication strategy for Passport.
The npm package passport-local-htpasswd receives a total of 12 weekly downloads. As such, passport-local-htpasswd popularity was classified as not popular.
We found that passport-local-htpasswd demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.