Externalauth account registration prefixes $authname

Created on 1 August 2024, 5 months ago

Problem/Motivation

When simplesamlphp_auth creates a new user via externalauth->register() it does not supply $account_data. Externalauth therefore prefixes the supplied $authname with the prefix 'simplesamlphp_auth_' and uses this value for the init and name account fields. These extra 19 letters mean that an email of length more than 41 characters will result in a DB error on externalauth's initial $account->save() since Drupal's name column in users_field_data table is limited to 60 characters. The watchdog error produced is String data, right truncated: 7 ERROR: value too long for type character varying(60): INSERT INTO "users_field_data" ....

If we could supply externalauth with the $account_data['name'] value it wants we could support longer emails.

Steps to reproduce

Attempt to register a user account with an email (and therefore name) of 42 characters, e.g. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@aaa.com.

Proposed resolution

Supply externalauth->register() with an $account_data['name'] value.

$account = $this->externalauth->register($authname, 'simplesamlphp_auth', ['name' => $authname]);
Feature request
Status

Needs review

Version

4.0

Component

Code

Created by

🇳🇿New Zealand patrickharris

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024