Passport strategy for two-factor authentication using Duo.
This module lets you authenticate using Duo two-factor authentication in your Node.js applications. By plugging into Passport, Duo's two-factor authentication can be easily and unobtrusively integrated into any application or framework that supports Connect-style middleware, including Express.
Note that in contrast to most Passport strategies, Duo's two-factor authentication requires that a user already be authenticated using an initial factor. Requirements regarding when to require a second factor are a matter of application-level policy, and outside the scope of both Passport and this strategy.
$ npm install passport-duo
The Duo authentication strategy authenticates a user using a Duo's UI, which either enrolls or authenticates users. The strategy requires specifying the integration key, secret key, application host and the login URL that has the Duo Web SDK iframe.
passport.use(new DuoStrategy(ikey, skey, host, loginUrl));
Use passport.authenticate()
, specifying the 'duo'
strategy, to authenticate
requests.
For example, as route middleware in an Express application:
app.get('/verify-duo',
passport.authenticate('duo', { failureRedirect: '/verify-duo' }),
function(req, res) {
req.session.authFactors = [ 'duo' ];
});
For a complete, working example, refer to the two-factor example.
$ npm install
$ make test
Copyright (c) 2015 Bashar Al-Rawi