Package Exports
- passport-mspassport
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (passport-mspassport) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
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'));