jaredhanson / passport

Simple, unobtrusive authentication for Node.js.
https://www.passportjs.org?utm_source=github&utm_medium=referral&utm_campaign=passport&utm_content=about
MIT License
22.92k stars 1.24k forks source link

http2 and perhaps many other server implementations not supported #383

Open shekhei opened 9 years ago

shekhei commented 9 years ago

Since passport modifies the IncomingMessage.prototype directly, there are some server implementations out there that seems to be affected, most significantly node-http2.

node-http2 does not use the http.IncomingMessage. Any plans on improving this technique of directly modifying the http.IncomingMessage.prototype?

AdrianRossouw commented 9 years ago

it seems to be separated out enough that it's possible to use different integrations : https://github.com/jaredhanson/passport/blob/master/lib/http/request.js

I was actually just considering whether it would be possible to do authenticated node streams (object mode of course). I can't think of anything that would block this in the core library (although individual strategies might)

jaredhanson commented 9 years ago

Yep, exactly. At one point I did have some prototypes of using Passport to authenticate other, non-HTTP protocols. The idea is that this is modular enough that you can swap out the underlying protocol implementation. Obviously that's not the primary use case, so if you try this and run into any gotcha's, let me know and we can clean it up.

shekhei commented 9 years ago

Perhaps this request.js could be rewritten to "extend" any object, instead of requiring req directly? so at least we will always have latest implementation when any one bumps passport versions.

marcbachmann commented 8 years ago

I also wanted to have a framework- & server-independent solution. So I've extracted the code required for the authentication into a separate library. https://www.npmjs.com/package/passport-light