passport-hawk
Passport strategy for the Hawk authentication schema.
Last updated 2 years ago by jfromaniello .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install passport-hawk 
SYNC missed versions from official npm registry.

Passport.js stategy for the Hawk authentication scheme.

Build Status

This module allows you to use Hawk as an authentication strategy with passport.

Installation

npm install passport-hawk

Usage

var HawkStrategy = require('passport-hawk');

passport.use('my-hawk-strategy', new HawkStrategy(function (id, done) {
  Users.findById(id, function (err, user){
    if(err) return done(err);
    done(null, {
      key: 		 user.secret,
      algorithm: 'sha256', // sha1 or sha256
      user:		 user
    });
  });
}));

then you can set my-hawk-strategy as a middlware in any route. For instance:

  myExpressApp.use('/api', 
  	passport.authenticate('my-hawk-strategy', { session: false }));

Bewit support

passport-hawk can be used to validate bewit:

var HawkStrategy = require('passport-hawk');

passport.use('my-hawk-strategy', new HawkStrategy({ bewit: true }, function (id, done) {
  //..same as previous section
});

License

MIT

Current Tags

  • 4.0.0                                ...           latest (2 years ago)
  • 0.2.1                                ...           old-0.2-version (3 years ago)

14 Versions

  • 4.0.0                                ...           2 years ago
  • 3.0.0                                ...           3 years ago
  • 0.2.1                                ...           3 years ago
  • 2.0.0                                ...           4 years ago
  • 1.0.1                                ...           5 years ago
  • 0.2.0                                ...           7 years ago
  • 0.1.2                                ...           7 years ago
  • 0.1.1                                ...           7 years ago
  • 0.1.0                                ...           7 years ago
  • 0.0.5                                ...           7 years ago
  • 0.0.4                                ...           7 years ago
  • 0.0.3                                ...           7 years ago
  • 0.0.2                                ...           7 years ago
  • 0.0.1                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 1
Last Month 0
Dependencies (3)
Dev Dependencies (2)

Copyright 2014 - 2016 © taobao.org |