This is exactly the same issue as #1280930, but for 7.x-3.x-dev.

Pulled from that issue's description...
When attempting to login with an existing user on the IdP, but new to Drupal, a new user is created without issue. When attempting to login with an existing user, where the user id exists on both the IdP and the Drupal site, I receive the following error:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'username' for key 'name': UPDATE {users} SET name=:db_update_placeholder_0 WHERE (uid = :db_condition_placeholder_0) ; Array ( [:db_update_placeholder_0] => username [:db_condition_placeholder_0] => 16555 ) in simplesamlphp_auth_user_insert() (line 326 of [path to]\sites\all\modules\simplesamlphp_auth\simplesamlphp_auth.module).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

richburke’s picture

Attached is a patch that addresses the above issue.

It's based very, very heavily upon the flexible solution by steven.wichers. (#29)

richburke’s picture

Issue summary: View changes

Update introductory description.

Elijah Lynn’s picture

Elijah Lynn’s picture

Issue summary: View changes
richburke’s picture

Updated the patch slightly so that the addauthmaps_alter() returns a more predictable result.

richburke’s picture

Fixed issue in above.

richburke’s picture

And this is it. I'm done.

odegard’s picture

Version: 7.x-2.0-alpha2 » 7.x-3.x-dev

I wasn't aware that this patch was for 3.x, setting the correct version. Hope this is ok.

odegard’s picture

Now I'm confused. The patch is adding stuff to a function simplesamlphp_auth_init(), but there is no such function in 3.x. I've added this function myself in a patch myself in https://www.drupal.org/node/2360555

Did you apply any other patches to 3.x before the current patch in this issue?

snufkin’s picture

We are trying to get rid of the hook_init call in the module in order to have Varnish support, so I don't think that this will apply to 3.x. Since #2360555: User is not logged out locally when logging out from another service is the issue for 3.x, did you mean in the OP that this is the patch for 2.x by chance?

snufkin’s picture

Version: 7.x-3.x-dev » 7.x-2.x-dev
Status: Active » Needs work

This patch also seems to contain the changeset from #1280930: Create authmap entries for pre-existing Drupal users, could we remove that please, or make an interdiff, so I could review just this change?

selwynpolit’s picture

When trying to apply the patch #7, I get:
patching file simplesamlphp_auth.module
patch: **** malformed patch at line 35: _simplesaml_auth_debug(t('Register [%authname]', array('%authname' => $authname)));

Trying to manually apply it now.
ok, it appears to be working now. I'll try rolling a new patch.

selwynpolit’s picture

Here is my version of the patch. I also added the uninstall variable.