jaredhanson / passport-http

HTTP Basic and Digest authentication strategies for Passport and Node.js.
https://www.passportjs.org/packages/passport-http/?utm_source=github&utm_medium=referral&utm_campaign=passport-http&utm_content=about
MIT License
268 stars 110 forks source link

Strategy naming for basic auth #64

Closed korialis closed 7 years ago

korialis commented 7 years ago

Maybe I'm missing something: I'm trying to implement a service using different 'layers of authentication', to do so I'd like to specify 3 different BasicStrategy. As I understood from an old issue (https://github.com/jaredhanson/passport/issues/50) this is possible for LocalStrategy, but I've been unsuccessfull to do the same for BasicStrategy, since the constructor doesn't allow custom names.

Is there any reason for this asymmetric behaviour between the strategies?

I even tried to instantiate the strategy, then assign a custom name and use it like this:

var adminStrat = new BasicStrategy(.....);

passport.use('admin-strat', adminStrat);
exports.isAdmin = passport.authenticate('admin-strat', { session: false });
korialis commented 7 years ago

My fault, had a misleading bug not relating passport, sorry for the useless issue...closing it!