Closed (fixed)
Project:
OpenID Connect / OAuth client
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
28 Aug 2015 at 21:04 UTC
Updated:
4 Jul 2020 at 12:19 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
illeace commentedHere's the promised patch file.
Comment #3
othermachines commentedComment #4
othermachines commentedI think this is a great feature. Patch applies cleanly and works as advertised.
A couple of comments:
- Do you think
$accountshould also be passed in as an argument? Whether the account exists may be useful info in some circumstances. (Although I can't think of any off the top of my head.)- In the API example, can we use a value we know will exist, like
$userinfo['email']? I was a little confused by what$userinfo['hd']was supposed to be.Thanks a lot for this!
Comment #5
illeace commentedBoth suggestions seem reasonable to me. The revised patch now passes $account as a parameter to the hook, and I've update the example in the API file to be a little more generic.
Comment #6
othermachines commentedPatch applies. I further tested it by implementing a hook with the example code and it all checks out.
Great work. I would love to see this committed!
Comment #7
othermachines commented@illeace I came across an issue unrelated to your patch while testing: #2590875: Missing $userinfo check results in account being created with no user information. A side effect of this problem when your patch is applied is that
$userinfo['email']is empty in your watchdog message:If you have time to pop over there and test the other patch it would be much appreciated.
Comment #8
aron novakI did a review and tested the patch, it's especially helpful if you'd like to perform an additional validation before login, for instance against the organization inside GitHub for the user trying to login. The patch worked without any issues, however comment https://www.drupal.org/node/2559543#comment-10446399 is still valid, but it's outside of the scope here.
Comment #9
ayduns commentedAlso tested this with a custom module implementing the hook to check the email domain. Works well. My testing did not trigger the issues reported with empty
$userinfo['email']- the watchdog messages contained the user email. Would be great to get this committed.Comment #10
hugovk commentedComment #11
jcnventuraThanks!
Comment #13
jcnventuraFor consistency with the D8 version, the hook is now called
hook_openid_connect_pre_authorize. Those using this patch will need to rename their existing hook functions. That was the only change I did.Comment #14
jcnventura