我想使用https://github.com/abbr/nodesspi
我正在尝试使用 justify 而不是 express。看起来它应该可以工作,但事实并非如此。它几乎相当于快递片段。我在身份验证函数中收到一个错误,告诉我我传递了一个错误的参数。
const fastify = require('fastify')({
logger: true,
})
fastify.route({
method: 'GET',
url: '/login',
onRequest: function (req, res, next) {
var nodeSSPI = require('node-sspi')
var nodeSSPIObj = new nodeSSPI({
retrieveGroups: true
})
nodeSSPIObj.authenticate(req, res, function (err) {
res.finished || next()
})
},
handler: function (req, res, next) {
var out =
'Hello ' +
req.connection.user +
'! Your sid is ' +
req.connection.userSid +
' and you belong to following groups:<br/><ul>'
if (req.connection.userGroups) {
for (var i in req.connection.userGroups) {
out += '<li>' + req.connection.userGroups[i] + '</li><br/>\n'
}
}
out += '</ul>'
res.send(out)
}
})
fastify.listen(4000, err => {
if (err) throw err
})
“fastify”:“^3.3.0”,“node-sspi”:“^0.2.8”,