passport-mspassport
v0.0.8
Published
Microsoft Passport & Windows Hello provider for PassportJS
Downloads
3
Maintainers
Readme
passport-mspassport
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'));