diff --git a/README.md b/README.md index 6c78c62..0626867 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,6 @@ It's not recommended, but it's possible to add NTLM-Authentication without valid | Name | type | default | description | |------|------|---------|-------------| | `badrequest` | `function` | `function(request, response, next) { response.sendStatus(400); }` | Function to handle HTTP 400 Bad Request. | -| `internalservererror` | `function` | `function(request, response, next) { response.sendStatus(500); }` | Function to handle HTTP 500 Internal Server Error. | | `forbidden` | `function` | `function(request, response, next) { response.sendStatus(403); }` | Function to handle HTTP 403 Forbidden. | | `unauthorized` | `function` | `function(request, response, next) { response.statusCode = 401; response.setHeader('WWW-Authenticate', 'NTLM'); response.end(); }` | Function to handle HTTP 401 Unauthorized. | | `prefix` | `string` | `[express-ntlm]` | The prefix is the first argument passed to the `debug`-function. | diff --git a/lib/express-ntlm.js b/lib/express-ntlm.js index c25c6b4..08fb2f5 100644 --- a/lib/express-ntlm.js +++ b/lib/express-ntlm.js @@ -26,9 +26,6 @@ module.exports = function(options) { badrequest: function(request, response, next) { response.sendStatus(400); }, - internalservererror: function(request, response, next) { - response.sendStatus(500); - }, forbidden: function(request, response, next) { response.sendStatus(403); }, @@ -237,7 +234,7 @@ module.exports = function(options) { return handle_type1(request, response, next, ah_data[1], function(error) { if (error) { options.debug(options.prefix, error.stack); - return options.internalservererror(request, response, next); + return options.unauthorized(request, response, next); } }); } @@ -247,12 +244,12 @@ module.exports = function(options) { return handle_type3(request, response, next, ah_data[1], function(error) { if (error) { options.debug(options.prefix, error.stack); - return options.internalservererror(request, response, next); + return options.unauthorized(request, response, next); } }); } options.debug(options.prefix, 'Unexpected NTLM message Type 3 in new connection for URI ' + request.protocol + '://' + request.get('host') + request.originalUrl); - return options.internalservererror(request, response, next); + return options.unauthorized(request, response, next); } options.debug(options.prefix, 'Type 2 message in client request'); return options.badrequest(request, response, next);