We want students from other universities to be able to log in to our moodle site using their universities' Shibboleth IdP. The foreign IdPs provide us with a pairwise ID instead of a username. This pairwise ID is formatted as a SAML subject identifier:
The problem is that we cannot save this subject identifier in the moodle username field for two reasons:
- The value may contain an equals sign ("="), which isn't allowed in moodle usernames.
- The value may be up to 255 characters long, far exceeding the moodle username length limit of 100 characters.
We are aware that the first problem can probably be worked around by enabling the extendedusernamechars config option, although we'd prefer only allowing the equals sign, not any special character. The second problem is more problematic anyway, since the database field for the username is only 100 characters long and cannot be extended using a config option.
Therefore, we suggest that the username field should be extended to allow for SAML subject identifiers to be saved in it. We think that this is a use case that should be accounted for by Moodle, since Moodle even offers it's own Shibboleth WAYF service, encouraging admins to allow users from multiple IdPs.
We propose the following changes:
- Extend the username database field to 255 characters.
- Add a config option to set the maximum username length (up to 255, defaults to 100).
- Add a config option to specify the list of characters allowed in usernames (defaults to a-z, 0-9 and "-.@_").