OpenID Connect providers advertise their provider configuration in JSON at http://example.com/.well-known/openid-configuration. Rather than requiring users to enter their endpoints (and rather than hardcoding Google's URIs), the module should simply prompt for the provider's issuer URI (typically the base URI for the provider), and get the provider configuration dynamically.
I'm happy to write the patch for this, if there's consensus about how it should be implemented. My preference would be to modify the Base class (in a backwards-compatible way) to accept the provider URI, and fetch the configuration via JSON in getEndpoints()
Issue fork openid_connect-2458421
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #1
bojanz commentedThis is a different spec, and is optional as far as OpenID Connect is concerned. Changing to feature request.
I'm +1 on implementing this, but we'd need to make sure that the oauth2-server-php library and the oauth2_server module support it first (since they are usually used together with this module).
Comment #2
andres.torres commentedHi all,
Just wanted to let you know that I have released a sandbox project that can hopefully be part of the OpenID Connect module in future releases. It includes the Discovery workflow as well as the logout (end session, refresh token) workflow for openid connect.
You can find the sandbox project here: https://www.drupal.org/sandbox/antrecu/2475233
Please visit the project page and the demo sites for more information and to provide feedback.
Thank you!
Comment #3
frodeste commentedI have reviewed the sandbox module. I would really like to see this included in the OpenID module as standard.
How can I help?
Comment #4
sebastien m. commentedHere is a lighter solution.
Hope it helps someone.
Comment #5
othermachines commentedI've tested and reviewed the patch in #4. I think it's a sensible approach and the patch works as advertised. I'm attaching a re-roll that adds some minor docblock formatting/comment fixes.
It would be great to get a patch for 8.x branch.
We are looking at using the generic provider, with this feature added, instead of the google provider to deal with the Google Plus shutdown starting in January. It would be nice if we could enable discovery for the google provider, as well, so we wouldn't have to migrate the authmap data. We aren't using profile pictures - the only thing the google provider offers apart from hard-coded endpoints (as far as I can tell) - so that isn't a problem for us, but might be for others. Does anyone have any thoughts on this?
Thanks!
Comment #6
othermachines commentedThis is first pass on a 8.x port of the patch in #5. I'm going to change the version on this issue since I believe the convention is to get 8.x patches committed first, then backport.
Cheers -
Comment #7
guypaddock commentedJust tried out the 7.x version of this patch from #5, and have some feedback to offer:
getEndpoints()should not allow the structure of the auto-discover document to drive the detection of the endpoints. Here's why:Comment #8
guypaddock commentedSetting to Needs Work b/c my feedback appears to also apply to the 8.x version, since it's a port of the 7.x verson.
Comment #9
andres.torres commentedI'm so glad the code I shared became useful! I'm taking down the testing sites but if theres any help needed on this matter, I'll be around. Thanks everyone for the hard work!
Comment #10
tim_djShouldn't we verify the configuration on save and actually store the value acquired from the .well-known to normal configuration values and regularly (cron) update these values. That way we don't spam the .well-known address and if the configuration is temporary missing or flawed we still have to old working configuration values.
Comment #11
othermachines commentedHere is an 8.x patch based on feedback from @GuyPaddock and @tim_dj. I worked on it awhile back but then I got busy. No doubt it needs work but hopefully it gets us most of the way there.
Edit: Don't use this patch. See #12
Comment #12
othermachines commentedHere's a better patch but it still needs work.
Major changes since patch in #6 (interdiff provided):
- Provides a new OpenIDConnectAutoDiscover service that makes a request to the issuer URL and returns the endpoint values.
- Modifies OpenIDConnectGenericClient to validate issuer URL and update _endpoint values when configuration form is submitted.
- Implements hook_cron to initiate auto-discovery of endpoints on a weekly basis.
Comment #13
othermachines commentedWe need an update hook to handle these config changes.
Edit: Also add these new keys to config\schema\openid_connect.schema.yml.
Comment #14
othermachines commentedHere is another patch based on my comments in #13. A review would be appreciated. :)
Comment #15
jax commented@othermachines: WIll test it but I think you should make the tests pass as well.
Comment #16
jcnventuraPatch no longer applies
Comment #17
jedihe commentedComment #18
jedihe commentedComment #20
jedihe commentedRe-rolled #14 and created MR 5 from it. I only did minor changes to docblocks.
I'm also attaching:
I didn't test:
Comment #21
jcnventuraNeeds a re-roll again now that I've changed how the module works.
Comment #23
jcnventuraThanks for the patches everyone. I've committed a re-rolled version still without the cron update. Mostly because this must be left to the plugin itself how to handle. A normal IDP shouldn't be switching their endpoints regularly, so I think most plugins can choose to keep the endpoint URLs hard-coded.
I'll create a new issue for the cron update.
Comment #25
othermachines commentedNow that this is fixed in 8.x, shouldn't we backport to 7.x-1.x? Attaching a re-rolled version of the patch in #5. I'm not sure if I need to open a brand new issue. Please advise. :)