All Projects → jaredhanson → Passport Local

jaredhanson / Passport Local

Licence: mit
Username and password authentication strategy for Passport and Node.js.

Programming Languages

javascript
184084 projects - #8 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to Passport Local

todos-express-password
Todo app using Express and Passport for sign in with username and password.
Stars: ✭ 739 (-70.96%)
Mutual labels:  password, passport
Ad Password Protection
Active Directory password filter featuring breached password checking and custom complexity rules
Stars: ✭ 210 (-91.75%)
Mutual labels:  password
Koa Passport Mongoose Graphql
Koa 2 server with Passport + Mongoose + GraphQL
Stars: ✭ 190 (-92.53%)
Mutual labels:  passport
Saas
Build your own SaaS business with SaaS boilerplate. Productive stack: React, Material-UI, Next, MobX, WebSockets, Express, Node, Mongoose, MongoDB. Written with TypeScript.
Stars: ✭ 2,720 (+6.88%)
Mutual labels:  passport
Pass Update
A pass extension that provides an easy flow for updating passwords.
Stars: ✭ 191 (-92.5%)
Mutual labels:  password
Login With
Stateless login-with microservice for OAuth
Stars: ✭ 2,301 (-9.59%)
Mutual labels:  passport
Applocker
AppLocker - simple lock screen for iOS Application ( Swift 4+, iOS 9.0+) Touch ID / Face ID
Stars: ✭ 188 (-92.61%)
Mutual labels:  password
React Native Smooth Pincode Input
A cross-platform, smooth, lightweight, customizable PIN code input component for React Native.
Stars: ✭ 216 (-91.51%)
Mutual labels:  password
Go Guardian
Go-Guardian is a golang library that provides a simple, clean, and idiomatic way to create powerful modern API and web authentication.
Stars: ✭ 204 (-91.98%)
Mutual labels:  passport
Filevaultcracker
macOS FileVault cracking tool
Stars: ✭ 199 (-92.18%)
Mutual labels:  password
Stormkitty
🔑 Open source stealer written on C#, all logs will be sent to Telegram bot.
Stars: ✭ 198 (-92.22%)
Mutual labels:  password
Awesome Iam
👤 Identity and Access Management Knowledge for Cloud Platforms
Stars: ✭ 186 (-92.69%)
Mutual labels:  password
Pwdb Public
A collection of all the data i could extract from 1 billion leaked credentials from internet.
Stars: ✭ 2,497 (-1.89%)
Mutual labels:  password
Mysql Unsha1
Authenticate against a MySQL server without knowing the cleartext password
Stars: ✭ 191 (-92.5%)
Mutual labels:  password
Hackers Tool Kit
Its a framework filled with alot of options and hacking tools you use directly in the script from brute forcing to payload making im still adding more stuff i now have another tool out called htkl-lite its hackers-tool-kit just not as big and messy to see updates check on my instagram @tuf_unkn0wn or if there are any problems message me on instagram
Stars: ✭ 211 (-91.71%)
Mutual labels:  password
Zxcvbn4j
This is a java port of zxcvbn, which is a JavaScript password strength generator.
Stars: ✭ 188 (-92.61%)
Mutual labels:  password
Python Scripts
Collection of Various Python Script's.💻
Stars: ✭ 195 (-92.34%)
Mutual labels:  password
Libreauth
LibreAuth is a collection of tools for user authentication.
Stars: ✭ 201 (-92.1%)
Mutual labels:  password
Mern Passport
A boilerplate example of using passport.js for authenticating a MERN application
Stars: ✭ 214 (-91.59%)
Mutual labels:  passport
Passport
Passport module for Nest framework (node.js) 🔑
Stars: ✭ 211 (-91.71%)
Mutual labels:  passport

passport-local

Passport strategy for authenticating with a username and password.

This module lets you authenticate using a username and password in your Node.js applications. By plugging into Passport, local authentication can be easily and unobtrusively integrated into any application or framework that supports Connect-style middleware, including Express.


Advertisement
1Password, the only password manager you should trust. Industry-leading security and award winning design.


npm build coverage ...

Install

$ npm install passport-local

Usage

Configure Strategy

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 LocalStrategy(
  function(username, password, done) {
    User.findOne({ username: username }, function (err, user) {
      if (err) { return done(err); }
      if (!user) { return done(null, false); }
      if (!user.verifyPassword(password)) { return done(null, false); }
      return done(null, user);
    });
  }
));
Available Options

This strategy takes an optional options hash before the function, e.g. new LocalStrategy({/* options */, callback}).

The available options are:

  • usernameField - Optional, defaults to 'username'
  • passwordField - Optional, defaults to 'password'

Both fields define the name of the properties in the POST body that are sent to the server.

Parameters

By default, LocalStrategy expects to find credentials in parameters named username and password. If your site prefers to name these fields differently, options are available to change the defaults.

passport.use(new LocalStrategy({
    usernameField: 'email',
    passwordField: 'passwd',
    session: false
  },
  function(username, password, done) {
    // ...
  }
));

When session support is not necessary, it can be safely disabled by setting the session option to false.

The verify callback can be supplied with the request object by setting the passReqToCallback option to true, and changing callback arguments accordingly.

passport.use(new LocalStrategy({
    usernameField: 'email',
    passwordField: 'passwd',
    passReqToCallback: true,
    session: false
  },
  function(req, username, password, done) {
    // request object is now first argument
    // ...
  }
));

Authenticate Requests

Use passport.authenticate(), specifying the 'local' strategy, to authenticate requests.

For example, as route middleware in an Express application:

app.post('/login', 
  passport.authenticate('local', { failureRedirect: '/login' }),
  function(req, res) {
    res.redirect('/');
  });

Examples

Additional examples can be found on the wiki.

License

The MIT License

Copyright (c) 2011-2015 Jared Hanson <http://jaredhanson.net/>

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].