passport-duo
v0.1.2
Published
Duo authentication strategy for Passport.
Downloads
54
Maintainers
Readme
Passport-Duo
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.
Install
$ npm install passport-duo
Usage
Configure Strategy
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));
Authenticate Requests
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' ];
});
Examples
For a complete, working example, refer to the two-factor example.
Tests
$ npm install
$ make test
Credits
License
Copyright (c) 2015 Bashar Al-Rawi