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).
Comments
Comment #1
richburke CreditAttribution: richburke commentedAttached is a patch that addresses the above issue.
It's based very, very heavily upon the flexible solution by steven.wichers. (#29)
Comment #2
richburke CreditAttribution: richburke commentedUpdate introductory description.
Comment #3
Elijah LynnComment #4
Elijah LynnComment #5
richburke CreditAttribution: richburke commentedUpdated the patch slightly so that the addauthmaps_alter() returns a more predictable result.
Comment #6
richburke CreditAttribution: richburke commentedFixed issue in above.
Comment #7
richburke CreditAttribution: richburke commentedAnd this is it. I'm done.
Comment #8
odegard CreditAttribution: odegard commentedI wasn't aware that this patch was for 3.x, setting the correct version. Hope this is ok.
Comment #9
odegard CreditAttribution: odegard commentedNow 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?
Comment #10
snufkin CreditAttribution: snufkin commentedWe 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?
Comment #11
snufkin CreditAttribution: snufkin commentedThis 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?
Comment #12
selwynpolit CreditAttribution: selwynpolit commentedWhen 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.
Comment #13
selwynpolit CreditAttribution: selwynpolit commentedHere is my version of the patch. I also added the uninstall variable.