package.json 8.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. {
  2. "name": "passport",
  3. "version": "0.2.1",
  4. "description": "Simple, unobtrusive authentication for Node.js.",
  5. "keywords": [
  6. "express",
  7. "connect",
  8. "auth",
  9. "authn",
  10. "authentication"
  11. ],
  12. "author": {
  13. "name": "Jared Hanson",
  14. "email": "jaredhanson@gmail.com",
  15. "url": "http://www.jaredhanson.net/"
  16. },
  17. "homepage": "http://passportjs.org/",
  18. "repository": {
  19. "type": "git",
  20. "url": "git://github.com/jaredhanson/passport.git"
  21. },
  22. "bugs": {
  23. "url": "http://github.com/jaredhanson/passport/issues"
  24. },
  25. "licenses": [
  26. {
  27. "type": "MIT",
  28. "url": "http://www.opensource.org/licenses/MIT"
  29. }
  30. ],
  31. "main": "./lib",
  32. "dependencies": {
  33. "passport-strategy": "1.x.x",
  34. "pause": "0.0.1"
  35. },
  36. "devDependencies": {
  37. "mocha": "1.x.x",
  38. "chai": "1.x.x",
  39. "chai-connect-middleware": "0.3.x",
  40. "chai-passport-strategy": "0.2.x",
  41. "proxyquire": "0.5.x"
  42. },
  43. "engines": {
  44. "node": ">= 0.4.0"
  45. },
  46. "scripts": {
  47. "test": "mocha --reporter spec --require test/bootstrap/node test/*.test.js test/**/*.test.js"
  48. },
  49. "readme": "# Passport\n\n[![Build](https://travis-ci.org/jaredhanson/passport.png)](https://travis-ci.org/jaredhanson/passport)\n[![Coverage](https://coveralls.io/repos/jaredhanson/passport/badge.png)](https://coveralls.io/r/jaredhanson/passport)\n[![Quality](https://codeclimate.com/github/jaredhanson/passport.png)](https://codeclimate.com/github/jaredhanson/passport)\n[![Dependencies](https://david-dm.org/jaredhanson/passport.png)](https://david-dm.org/jaredhanson/passport)\n[![Tips](http://img.shields.io/gittip/jaredhanson.png)](https://www.gittip.com/jaredhanson/)\n\n\nPassport is [Express](http://expressjs.com/)-compatible authentication\nmiddleware for [Node.js](http://nodejs.org/).\n\nPassport's sole purpose is to authenticate requests, which it does through an\nextensible set of plugins known as _strategies_. Passport does not mount\nroutes or assume any particular database schema, which maximizes flexiblity and\nallows application-level decisions to be made by the developer. The API is\nsimple: you provide Passport a request to authenticate, and Passport provides\nhooks for controlling what occurs when authentication succeeds or fails.\n\n## Install\n\n $ npm install passport\n\n## Usage\n\n#### Strategies\n\nPassport uses the concept of strategies to authenticate requests. Strategies\ncan range from verifying username and password credentials, delegated\nauthentication using [OAuth](http://oauth.net/) (for example, via [Facebook](http://www.facebook.com/)\nor [Twitter](http://twitter.com/)), or federated authentication using [OpenID](http://openid.net/).\n\nBefore authenticating requests, the strategy (or strategies) used by an\napplication must be configured.\n\n passport.use(new LocalStrategy(\n function(username, password, done) {\n User.findOne({ username: username }, function (err, user) {\n if (err) { return done(err); }\n if (!user) { return done(null, false); }\n if (!user.verifyPassword(password)) { return done(null, false); }\n return done(null, user);\n });\n }\n ));\n\n#### Sessions\n\nPassport will maintain persistent login sessions. In order for persistent\nsessions to work, the authenticated user must be serialized to the session, and\ndeserialized when subsequent requests are made.\n\nPassport does not impose any restrictions on how your user records are stored.\nInstead, you provide functions to Passport which implements the necessary\nserialization and deserialization logic. In a typical application, this will be\nas simple as serializing the user ID, and finding the user by ID when\ndeserializing.\n\n passport.serializeUser(function(user, done) {\n done(null, user.id);\n });\n\n passport.deserializeUser(function(id, done) {\n User.findById(id, function (err, user) {\n done(err, user);\n });\n });\n\n#### Middleware\n\nTo use Passport in an [Express](http://expressjs.com/) or\n[Connect](http://senchalabs.github.com/connect/)-based application, configure it\nwith the required `passport.initialize()` middleware. If your application uses\npersistent login sessions (recommended, but not required), `passport.session()`\nmiddleware must also be used.\n\n app.configure(function() {\n app.use(express.static(__dirname + '/../../public'));\n app.use(express.cookieParser());\n app.use(express.bodyParser());\n app.use(express.session({ secret: 'keyboard cat' }));\n app.use(passport.initialize());\n app.use(passport.session());\n app.use(app.router);\n });\n\n#### Authenticate Requests\n\nPassport provides an `authenticate()` function, which is used as route\nmiddleware to authenticate requests.\n\n app.post('/login', \n passport.authenticate('local', { failureRedirect: '/login' }),\n function(req, res) {\n res.redirect('/');\n });\n\n## Strategies\n\nPassport has a comprehensive set of **over 140** authentication strategies\ncovering social networking, enterprise integration, API services, and more.\nThe [complete list](https://github.com/jaredhanson/passport/wiki/Strategies) is\navailable on the [wiki](https://github.com/jaredhanson/passport/wiki).\n\nThe following table lists commonly used strategies:\n\n|Strategy | Protocol |Developer |\n|---------------------------------------------------------------|--------------------------|------------------------------------------------|\n|[Local](https://github.com/jaredhanson/passport-local) | HTML form |[Jared Hanson](https://github.com/jaredhanson) |\n|[OpenID](https://github.com/jaredhanson/passport-openid) | OpenID |[Jared Hanson](https://github.com/jaredhanson) |\n|[BrowserID](https://github.com/jaredhanson/passport-browserid) | BrowserID |[Jared Hanson](https://github.com/jaredhanson) |\n|[Facebook](https://github.com/jaredhanson/passport-facebook) | OAuth 2.0 |[Jared Hanson](https://github.com/jaredhanson) |\n|[Google](https://github.com/jaredhanson/passport-google) | OpenID |[Jared Hanson](https://github.com/jaredhanson) |\n|[Google](https://github.com/jaredhanson/passport-google-oauth) | OAuth / OAuth 2.0 |[Jared Hanson](https://github.com/jaredhanson) |\n|[Twitter](https://github.com/jaredhanson/passport-twitter) | OAuth |[Jared Hanson](https://github.com/jaredhanson) |\n\n## Examples\n\n- For a complete, working example, refer to the [login example](https://github.com/jaredhanson/passport-local/tree/master/examples/login)\nincluded in [passport-local](https://github.com/jaredhanson/passport-local).\n- **Local Strategy**: Refer to this [tutorial](http://mherman.org/blog/2013/11/11/user-authentication-with-passport-dot-js/) on setting up user authentication via LocalStrategy (`passport-local`), including a working example found on this [repo](https://github.com/mjhea0/passport-local).\n- **Social Authentication**: Refer to this [tutorial](http://mherman.org/blog/2013/11/10/social-authentication-with-passport-dot-js/) for setting up various social authentication strategies, including a working example found on this [repo](https://github.com/mjhea0/passport-examples).\n\n## Related Modules\n\n- [Locomotive](https://github.com/jaredhanson/locomotive) — Powerful MVC web framework\n- [OAuthorize](https://github.com/jaredhanson/oauthorize) — OAuth service provider toolkit\n- [OAuth2orize](https://github.com/jaredhanson/oauth2orize) — OAuth 2.0 authorization server toolkit\n- [connect-ensure-login](https://github.com/jaredhanson/connect-ensure-login) — middleware to ensure login sessions\n\nThe [modules](https://github.com/jaredhanson/passport/wiki/Modules) page on the\n[wiki](https://github.com/jaredhanson/passport/wiki) lists other useful modules\nthat build upon or integrate with Passport.\n\n## Tests\n\n $ npm install\n $ make test\n\n## Credits\n\n - [Jared Hanson](http://github.com/jaredhanson)\n\n## License\n\n[The MIT License](http://opensource.org/licenses/MIT)\n\nCopyright (c) 2011-2014 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)>\n",
  50. "readmeFilename": "README.md",
  51. "_id": "passport@0.2.1",
  52. "_shasum": "a7d34c07b30fb605be885edbc8c93e5142e38574",
  53. "_from": "passport@^0.2.0",
  54. "_resolved": "https://registry.npmjs.org/passport/-/passport-0.2.1.tgz"
  55. }