jaredhanson / passport-openid

OpenID authentication strategy for Passport and Node.js.
https://www.passportjs.org/packages/passport-openid/?utm_source=github&utm_medium=referral&utm_campaign=passport-openid&utm_content=about
MIT License
98 stars 90 forks source link

Expose node-openid for mixins #4

Closed 2sidedfigure closed 12 years ago

2sidedfigure commented 12 years ago

It would be helpful to be able to provide mixins to node-openid for those of us who need a centralized store of association handles (e.g. multiple running instances of an application behind a load balancer).

abh commented 12 years ago

@jaredhanson Another option (which we'd be ok with, @2sidedfigure and I work together) would be to have the OpenID provider save the state in the session similar to the oauth stuff, that's what our mixin does I think.

jaredhanson commented 12 years ago

@abh Thanks for the update.

The pull request looks good, and the functionality is definitely needed. There's a major deployment that needs saved associations (I'll let them post here if they want), so this is certainly going to get pulled in soon. When that happens, I want to do a focused review to make sure all the bases are covered, and I haven't found that time yet. That's the only hang up right now on the merge, but the priority is increasing quickly.

ozten commented 12 years ago

That's right, we're working on deploying PassportJS as part of Mozilla's BrowserID.

Thanks @jaredhanson for a great project and @abh for a cool patch!

jaredhanson commented 12 years ago

Alrighty. This is done. I've reworked it a fair amount, so there are now separate saveAssociation and loadAssociation methods, for which you supply a save or load function. I liked this approach because its identical to serializeUser and deserializeUser in passport's login session support, thus keeping things nice and consistent. This also keeps it a bit more decoupled from the underlying node-openid module.

There are also saveDiscoveredInfo and loadDiscoveredInfo in case anyone's interested in storing that.

Everything is well documented in the source code, starting here: https://github.com/jaredhanson/passport-openid/blob/master/lib/passport-openid/strategy.js#L199

I'm happy with how it turned out. But, as always, send feedback if you've got it. Thanks for the patch!

jaredhanson commented 12 years ago

Also: published to npm as passport-openid v0.2.3