aedilis-passport

1.0.5 • Public • Published

aedilis-passport

Aedilis authentication strategy based on the HTTP Bearer authentication strategy for Passport.

Install

$ npm install aedilis-passport

Usage

Configure Strategy

The Aedilis strategy authenticates users using a bearer token and is built on top of the HTTP Bearer authentication strategy by Jared Hanson.
The verify callback needed by the HTTP Bearer strategy is implemented in the Aedilis strategy. During this callback a connection will be made to consul to resolve the token to a specific user.

passport.use(new AedilisStrategy({
  host: "<aedilis-host>",
  port: "<aedilis-port>"
}));

Authenticate Requests

Since the Aedilis strategy is an extension of the Bearer strategy you can use passport.authenticate(), specifying the 'bearer' strategy, to authenticate requests. Requests containing bearer tokens do not require session support, so the session option can be set to false.

For example, as route middleware in an Express application:

app.get('/profile', 
  passport.authenticate('bearer', { session: false }),
  function(req, res) {
    res.json(req.user);
  });

Package Sidebar

Install

npm i aedilis-passport

Weekly Downloads

2

Version

1.0.5

License

none

Last publish

Collaborators

  • bigdata-company