PassportJS provider for Microsoft Passport & Windows Hello authentication.
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.deployment
.gitignore
.npmignore
.travis.yml
LICENSE
README.md
package.json

README.md

passport-mspassport

Build Status

PassportJS strategy for authenticating with Microsoft Passport and Windows Hello.

This module lets you authenticate using Microsoft Passport in your Node.js applications.

Install

$ npm install passport-mspassport

Usage

Configure Strategy

// configure passport to use the MSPassportStrategy
passport.use("mspassport", new MSPassportStrategy({
    protocol: "custom",
    protocolHandler: function (req, callback) {
        //get the public key for this request.  If it's part of the
        //HTTP request, then get it from the header/querystring/body.
        //If it's stored in a db and the request has a username, look
        //up the public key from there.
        callback({
            publicKey: "",
            challenge: "",
            signature: ""
        });
    },
    findUserByPublicKey: function (key, callback) {
        users.findUserByPublicKey(key, function(user) {
            callback({
                "id" : user.id,
                "displayName" : user.displayName,
                "preferredUserName" : user.preferredUserName
            });
        });
    }
}));

Authenticate Requests

Use passport.authenticate(), specifying the 'mspassport' strategy, to authenticate requests.

For example, as route middleware in an Express application:

app.get('/auth/mspassport', passport.authenticate('mspassport'));