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 85 forks source link

Creating the OpenIDStrategy when request is available #15

Closed dpolivaev closed 11 years ago

dpolivaev commented 11 years ago

Hello,

above all thank you very much for work and sharing of your middleware, I like it very much and find it really easy to use. I would like to make one suggestion.

Configuring open id strategy requires knowledge of host URL used to define returnURL and realm. These values are not always known a priory during the application development. They also can differ in test and productive environments. Therefore is seems to be an advantage if the strategy can be configured after the request containing the host URL is already available.

Therefore I changed your login example so that the strategy is set when the authentication request is processed. It means that a new strategy object is used every time.

I would like to ask you to check if it is a valid usage of your software. If it can be done this way may be you want to include my solution in your example. If something is wrong please give a hint what should be changed.

Kind regards, Dimitry Polivaev

dpolivaev commented 11 years ago

I was told reasons to obtain this info from configuration files