Skip to content
This repository was archived by the owner on Jan 18, 2024. It is now read-only.

Commit b7bacc4

Browse files
committed
fix(strategy): support options as first strategy constructor argument, to support @nestjs/passport pattern
build(package): update package name for @briebug, bump version to 1.3.0
1 parent 6a8c666 commit b7bacc4

File tree

5 files changed

+471
-7
lines changed

5 files changed

+471
-7
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import passportCustom from 'passport-custom';
3535
const CustomStrategy = passportCustom.Strategy;
3636

3737
passport.use('strategy-name', new CustomStrategy(
38+
{},
3839
function(req, callback) {
3940
// Do your custom user finding logic here, or set to false based on req object
4041
callback(null, user);

lib/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export interface VerifiedCallback {
1010
}
1111

1212
export declare class Strategy extends PassportStrategy {
13-
constructor(verify: VerifyCallback);
13+
constructor(options: any, verify: VerifyCallback);
1414
authenticate(req: Request, options?: any): any;
1515
}
1616

lib/strategy.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var passport = require('passport-strategy'),
1111
* Applications must supply a `verify` callback which executes custom authentication logic, and then calls the `done` callback supplying a `user`, which should be set to `false` if the credentials are not valid. If an exception occured, `err` should be set.
1212
*
1313
* Examples:
14-
* passport.use(new CustomStrategy(
14+
* passport.use(new CustomStrategy({...},
1515
* function(req, done) {
1616
* User.findOne({
1717
* username: req.body.username
@@ -24,7 +24,7 @@ var passport = require('passport-strategy'),
2424
* @param {Function} verify Verifies the user.
2525
* @api public
2626
*/
27-
function Strategy(verify) {
27+
function Strategy(options, verify) {
2828
if (!verify) {
2929
throw new TypeError('CustomStrategy requires a verify callback');
3030
}

0 commit comments

Comments
 (0)