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?

Command icon 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

typhonius created an issue. See original summary.

aron novak’s picture

I can confirm that this is a valid issue.
Here's a patch for the 1.0 version.

aron novak’s picture

And a patch that applies cleanly to the dev.

aron novak’s picture

Status: Active » Needs review
aron novak’s picture

fixing a trivial error, no need to negate the result of authmap retrieval anymore.

aron novak’s picture

greggles’s picture

This 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?

rjg’s picture

The patch in #5 worked for me

ivavictoria’s picture

The 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!

luca_loguercio’s picture

I've rerolled for 1.3

svendecabooter’s picture

Version: 8.x-1.x-dev » 2.0.x-dev
maximpodorov’s picture

Re-roll.

bartlangelaan made their first commit to this issue’s fork.

bartlangelaan’s picture

I 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.

bgustafson’s picture

thanks, patch in #12 works for me

jcnventura’s picture

Status: Needs review » Reviewed & tested by the community

As per #16 and my own testing.

  • svendecabooter committed 20fc9be on 2.0.x
    Issue #2910506 by Aron Novak, bartlangelaan, maximpodorov,...

svendecabooter’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the patches and reviews!
This has now been committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.