We are seeing this too with SSO as well with usernames being converted.
I have mentioned this here, but this topic is more recent — maybe someone can take a look.
With the introduction of the Unicode support for usernames/groups, it is now possible to have usernames like 中国
(which is awesome!) but Discourse doesn’t allow usernames to start/end with a dash (but, eg, underscore is fine).
Is there a reason for preventing dashes in the first/last position? Any chance this policy can be revised if there’s no obvious downside to it? /cc @Falco