Working on a client site we created users initially before hooking the site up to the SSO provider. Upon linking everything together, we discovered that the username a user logs in with is not the username that we'd created in Drupal.
With this in mind, we changed the username in Drupal but login still didn't work. Further investigation yielded the authmap table storing the user's original name as the authname and not being updated (even with the relevant options selected in the simplesamlphp_auth module). Only when the Simplesamlphp_auth mode to auto-register is turned on does a user get logged in - and with that, they get a message stating that An account with this username already exists.
Before proceeding with a patch, I'd like to ask whether we need to look at some kind of hook_user_update() function to update authname in the authmap table when a user changes their name or should the authmap table be updated with the authname when a user logs in?
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | externalauth-authname_update-2910506-12.patch | 1.73 KB | maximpodorov |
| #10 | 2910506_externalauth_-authname-update-10.patch | 1.71 KB | luca_loguercio |
| #5 | 2910506_externalauth_-authname-update-5.patch | 1.74 KB | aron novak |
Issue fork externalauth-2910506
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:
- 2910506-usernames-authnames-do
changes, plain diff MR !6
Comments
Comment #2
aron novakI can confirm that this is a valid issue.
Here's a patch for the 1.0 version.
Comment #3
aron novakAnd a patch that applies cleanly to the
dev.Comment #4
aron novakComment #5
aron novakfixing a trivial error, no need to negate the result of authmap retrieval anymore.
Comment #6
aron novakComment #7
gregglesThis seems like an important bug to fix, though it's something people won't hit upon very often.
Thanks for the detailed report adammalone and your work on it Aron Novak!
@adammalone does this patch resolve the problem from your perspective?
Comment #8
rjg commentedThe patch in #5 worked for me
Comment #9
ivavictoriaThe patch in #5 works for me as well.
I really needed this and was about to create a patch myself; I'm glad a patch already exists!
Comment #10
luca_loguercio commentedI've rerolled for 1.3
Comment #11
svendecabooterComment #12
maximpodorov commentedRe-roll.
Comment #15
bartlangelaanI have created a MR which is almost the same as #12, but the $username is now changed to $account->getAccountName() and it also logs the uid and provider.
Comment #16
bgustafson commentedthanks, patch in #12 works for me
Comment #17
jcnventuraAs per #16 and my own testing.
Comment #20
svendecabooterThanks for the patches and reviews!
This has now been committed.