The one-time password strategy (the so-called one-time token) for resetting the password is what I will implement. Given Passport's architecture, this can easily be a standalone module, and it wouldn't surprise me to know that someone else has already implemented such a thing.
Remember that persistence token functionality is also what I would like to support. Preferably, I would like it to be a separate strategy, but this may require some basic support. If this turns out to be the case, a few extra lines in req.logIn
( https://github.com/jaredhanson/passport/blob/master/lib/passport/http/request.js#L28 ) should be able to cover it.
Regarding the storage of the user ID in the session, I do not see much risk, given that by default in Connect / Express the properties of the session are completely stored in the backend and are viewed by the unique sid
that is set in the encrypted cookie. An attacker must have both a unique sid secret and a session in order to spoof requests.
Mozilla uses Passport as part of its identification effort to link the browser with other providers that lack BrowserID support (see browserid-bigtent ). Given their requirements, developers can be sure that Passport meets stringent security requirements.
(Ultimately, serialization of the session in the Passport is the responsibility of the application, therefore, if necessary, a random token can be used instead of the user ID if necessary. Obviously, this should be done if the data is stored directly in a cookie, but I would assume that this is the worst approach .)
As for managing these properties on the model, Passport is designed to completely modify the model / ORM. I do not intend to ever change this fact, since I think that these solutions are best left to the application (and Passport is more flexible as a result of delegation of this responsibility). Nevertheless, I think that it is possible for other modules to build themselves on top of the Passport in order to provide this functionality.
All that said, I think Passport is the most reliable Node.js auth solution available. Your first three queries would go a long way to make it more, and should be easy to complete. I would like to collaborate in getting these features, so feel free to contact me.
Finally, in case anyone is interested, first-class API authentication is now at work, in the authinfo branch. Based on this, passport-http-oauth implements OAuth server strategies that can be combined with oauthorize middlware as tools for building OAuth servers. This is not completely baked, but it will be another effective Passport feature when it is ready.