forked from mikenicholson/passport-jwt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moves the logic that calls secretOrKeyProvider out of verify_jwt.js and back into lib/strategy.js. verify_jwt.js was intended to be a simple call-through function for the real verfier from jsonwebtoken. Changes the signature of secretOrKeyProvider to (request, token, done) from (token, done) to support a wider range of use cases. Updates tests for the above behavior.
- Loading branch information
1 parent
b3846ef
commit a236e40
Showing
4 changed files
with
107 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,5 @@ | ||
var jwt = require('jsonwebtoken'); | ||
|
||
module.exports = function(token, secretOrKeyProvider, options, callback, verify) { | ||
if (!verify) { | ||
verify = jwt.verify; | ||
} | ||
return secretOrKeyProvider(token, function (err, secretOrKey) { | ||
if (err) { | ||
callback(err); | ||
return; | ||
} | ||
verify(token, secretOrKey, options, callback); | ||
}); | ||
module.exports = function(token, secretOrKey, options, callback) { | ||
return jwt.verify(token, secretOrKey, options, callback); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters