{"bugs":{"url":"http://github.com/jaredhanson/passport-http-bearer/issues"},"dist":{"shasum":"506df0c57128226277408f5d25182403f47f4f2a","tarball":"https://registry.npmjs.org/passport-http-bearer/-/passport-http-bearer-0.2.1.tgz","integrity":"sha512-1oEf6zmUMWSFjoIeKacW4g/ZPggeX7hSc+C1uWLcK4Y2aVavU3Je8kW42Ubr2y4C/1O37wb6mv5XOotL10KuGA==","signatures":[{"sig":"MEUCIQDBo9kM5MsB/HVeliGsTSh8nZtF6K3qChl34SGigPOmRwIgTJwKmdx0WTMXxRmWG8AUicgkxhD0yjxZTfwvE2niMEA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./lib/passport-http-bearer","name":"passport-http-bearer","author":{"url":"http://www.jaredhanson.net/","name":"Jared Hanson","email":"jaredhanson@gmail.com"},"readme":"# Passport-HTTP-Bearer\n\nHTTP Bearer authentication strategy for [Passport](https://github.com/jaredhanson/passport).\n\nThis module lets you authenticate HTTP requests using bearer tokens in your\nNode.js applications.  Bearer tokens are typically used protect API endpoints,\nand are often issued using OAuth 2.0.\n\nBy plugging into Passport, bearer token support can be easily and unobtrusively\nintegrated into any application or framework that supports\n[Connect](http://www.senchalabs.org/connect/)-style middleware, including\n[Express](http://expressjs.com/).\n\n## Install\n\n    $ npm install passport-http-bearer\n\n## Usage\n\n#### Configure Strategy\n\nThe HTTP Bearer authentication strategy authenticates users using a bearer\ntoken.  The strategy requires a `verify` callback, which accepts that\ncredential and calls `done` providing a user.  Optional `info` can be passed,\ntypically including associated scope, which will be set by Passport at\n`req.authInfo` to be used by later middleware for authorization and access\ncontrol.\n\n    passport.use(new BearerStrategy(\n      function(token, done) {\n        User.findOne({ token: token }, function (err, user) {\n          if (err) { return done(err); }\n          if (!user) { return done(null, false); }\n          return done(null, user, { scope: 'all' });\n        });\n      }\n    ));\n\n#### Authenticate Requests\n\nUse `passport.authenticate()`, specifying the `'bearer'` strategy, to\nauthenticate requests.  Requests containing bearer tokens do not require session\nsupport, so the `session` option can be set to `false`.\n\nFor example, as route middleware in an [Express](http://expressjs.com/)\napplication:\n\n    app.get('/profile', \n      passport.authenticate('bearer', { session: false }),\n      function(req, res) {\n        res.json(req.user);\n      });\n\n## Implementation\n\nThis module is implemented based on [The OAuth 2.0 Authorization Protocol: Bearer Tokens](http://tools.ietf.org/html/draft-ietf-oauth-v2-bearer-12),\nDraft 12.  Implementers are encouraged to track the progress of this\nspecification and update update their implementations as necessary.\nFurthermore, the implications of relying on a non-final draft specification\nshould be understood prior to deployment.\n\n## Examples\n\nFor a complete, working example, refer to the [Bearer example](https://github.com/jaredhanson/passport-http-bearer/tree/master/examples/bearer).\n\n## Tests\n\n    $ npm install --dev\n    $ make test\n\n[![Build Status](https://secure.travis-ci.org/jaredhanson/passport-http-bearer.png)](http://travis-ci.org/jaredhanson/passport-http-bearer)\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-2013 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)>\n","engines":{"node":">= 0.4.0"},"scripts":{"test":"NODE_PATH=lib node_modules/.bin/vows test/*-test.js"},"_npmUser":{"name":"jaredhanson","email":"jaredhanson@gmail.com"},"keywords":["passport","http","bearer","oauth","authn","authentication"],"licenses":[{"url":"http://www.opensource.org/licenses/MIT","type":"MIT"}],"repository":{"url":"git://github.com/jaredhanson/passport-http-bearer.git","type":"git"},"_npmVersion":"1.1.62","description":"HTTP Bearer authentication strategy for Passport.","directories":{},"maintainers":[{"name":"jaredhanson","email":"jaredhanson@gmail.com"}],"dependencies":{"pkginfo":"0.2.x","passport":"~0.1.3"},"devDependencies":{"vows":"0.6.x"},"_id":"passport-http-bearer@0.2.1","version":"0.2.1"}