Closed muyu66 closed 5 years ago
I'm really not clear on what you're requesting. The name property is public and you are able to change it.
E.g.:
// test.js
var JwtStrategy = require('passport-jwt').Strategy,
ExtractJwt = require('passport-jwt').ExtractJwt;
var opts = {}
opts.jwtFromRequest = ExtractJwt.fromAuthHeaderAsBearerToken();
opts.secretOrKey = 'secret';
opts.issuer = 'accounts.examplesoft.com';
opts.audience = 'yoursite.net';
strategy = new JwtStrategy(opts, function(jwt_payload, done) {});
console.log("Default strategy name is: " + strategy.name);
strategy.name = "foobar";
console.log("Strategy is now named: " + strategy.name);
Output:
$ node test.js
Default strategy name is: jwt
Strategy is now named: foobar
Feel free to clarify your request or provide example code and reopen. For now I will close this as invalid.
It is recommended to set the name attribute of Strategy to public, which is convenient to set it as the base policy to modify.
position in passport-jwt/lib/strategy.js, 31 row