passport-ldapauth
Advanced tools
Comparing version 2.1.2 to 2.1.3
## Changes | ||
* v2.1.3 | ||
* [#86](https://github.com/vesse/passport-ldapauth/pull/86) Allow configuring missing credentials response status. | ||
* v2.1.2 | ||
@@ -4,0 +5,0 @@ * [#80](https://github.com/vesse/passport-ldapauth/pull/80) Run error handler only once since the a new LdapAuth instance is created for every authenticate request. |
@@ -131,2 +131,3 @@ 'use strict'; | ||
* @param {string} [options.passwordField=password] - Form field name for password | ||
* @param {Number} [options.missingCredentialsStatus=400] - HTTP status code returned when credentials are missing from the request | ||
* @param {boolean} [options.passReqToCallback=false] - If true, request is passed to verify callback | ||
@@ -252,3 +253,3 @@ * @param {credentialsLookup} [options.credentialsLookup] - Credentials lookup function to use instead of default | ||
if (!username || !password) { | ||
return this.fail({ message: options.badRequestMessage || 'Missing credentials' }, 400); | ||
return this.fail({ message: options.badRequestMessage || 'Missing credentials' }, this.options.missingCredentialsStatus || 400); | ||
} | ||
@@ -255,0 +256,0 @@ |
@@ -11,3 +11,4 @@ { | ||
"Anthony Hernandez <anthony.hernandez@clownphobia.com>", | ||
"Chris Harwood <harwood@teralogics.com>" | ||
"Chris Harwood <harwood@teralogics.com>", | ||
"David Dolcimascolo <david.dolcimascolo@stordata.fr>" | ||
], | ||
@@ -20,3 +21,3 @@ "keywords": [ | ||
], | ||
"version": "2.1.2", | ||
"version": "2.1.3", | ||
"license": "MIT", | ||
@@ -49,9 +50,9 @@ "main": "./lib/passport-ldapauth", | ||
"chai": "^4.2.0", | ||
"eslint": "^5.13.0", | ||
"eslint": "^5.16.0", | ||
"express": "^4.16.4", | ||
"ldapjs": "^1.0.1", | ||
"mocha": "^5.2.0", | ||
"mocha": "^6.0.2", | ||
"passport": "^0.4.0", | ||
"supertest": "^3.4.2", | ||
"typescript": "^3.3.3", | ||
"supertest": "^4.0.2", | ||
"typescript": "^3.4.1", | ||
"watch": "^1.0.2" | ||
@@ -64,4 +65,5 @@ }, | ||
"test": "NODE_PATH=lib mocha --reporter spec test/*-test.js", | ||
"test:watch": "watch 'npm test' ./lib ./test --wait 0.5", | ||
"test:typescript": "cd test/typescript && tsc" | ||
} | ||
} |
@@ -45,2 +45,3 @@ # passport-ldapauth | ||
* `credentialsLookup`: Optional, synchronous function that provides the login credentials from `req`. See [below](#credentialslookup) for more. | ||
* `missingCredentialsStatus`: Returned HTTP status code when credentials could not be found in the request. Defaults to _400_ | ||
* `handleErrorsAsFailures`: When `true`, unknown errors and ldapjs emitted errors are handled as authentication failures instead of errors (default: `false`). | ||
@@ -47,0 +48,0 @@ * `failureErrorCallback`: Optional, synchronous function that is called with the received error when `handleErrorsAsFailures` is enabled. |
@@ -227,2 +227,14 @@ var should = require('chai').Should(), | ||
}); | ||
it('should support returning a custom status code when credentials are missing', function(cb) { | ||
var OPTS = JSON.parse(JSON.stringify(BASE_OPTS)); | ||
OPTS.missingCredentialsStatus = 401; | ||
start_servers(OPTS, BASE_TEST_OPTS)(function() { | ||
request(expressapp) | ||
.post('/login') | ||
.expect(401) | ||
.end(cb); | ||
}); | ||
}); | ||
}); | ||
@@ -229,0 +241,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
55972
1104
205