Fix for SSPI auth un-authorized.
Ylian Saint-Hilaire committed
Jul 15, 2022 at 13:13 UTC
9f4c2cc53ea843e34a92b13c4880312bb8a8bce4
1 file changed
+2
-2
webserver.js
+2
-2
@@ -2606,14 +2606,14 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
2606
var q = require('url').parse(req.url, true);
2607
if (!q.pathname.endsWith('/login')) { res.redirect(domain.unknownuserrootredirect + getQueryPortion(req)); return; }
2608
}
2609
-
2609
+
2610
if ((domain.sspi != null) && ((req.query.login == null) || (obj.parent.loginCookieEncryptionKey == null))) {
2611
// Login using SSPI
2612
domain.sspi.authenticate(req, res, function (err) {
2613
if ((err != null) || (req.connection.user == null)) {
2614
if (obj.parent.authlog) { obj.parent.authLog('https', 'Failed SSPI-auth for ' + req.connection.user + ' from ' + req.clientIp + ' port ' + req.connection.remotePort); }
2615
parent.debug('web', 'handleRootRequest: SSPI auth required.');
2616
- res.end('Authentication Required...');
2616
+ res.sendStatus(401);
2617
} else {
2618
if (obj.parent.authlog) { obj.parent.authLog('https', 'Accepted SSPI-auth for ' + req.connection.user + ' from ' + req.clientIp + ' port ' + req.connection.remotePort); }
2619
parent.debug('web', 'handleRootRequest: SSPI auth ok.');