const userController = require('../../controllers/user.controller');
const asyncHandler = require("express-async-handler");
const nodeSSPI = require('node-sspi')
const nodeSSPIObj = new nodeSSPI({
domain: "XXX",
authoritative: true
});
module.exports = asyncHandler(async (req, res, next) => {
nodeSSPIObj.authenticate(req, res, async (err) => {
if (err)
throw err;
if (res.statusCode == null) {
let userCode = req.connection.user.substring(5, req.connection.user.length);
let user = await userController.getByCode(userCode);
if (user == null) throw new Error(`ERROR`);
req.user = user.toJSON();
next();
}
});
});
From above code I can see the authoritative set either true or false will have the same result
it wont write to err param and will write statusCode to the response
From above code I can see the authoritative set either true or false will have the same result it wont write to err param and will write statusCode to the response