The credential provider must transform a google account email address into a well formed Windows username. The current algorithm strips of the trailing TLD, replaces invalid characters with underscore (_) and truncates the resulting string to 20 characters. We may want to revisit this algorithm.
For stripping TLDs, chrome has code for this at https://cs.chromium.org/chromium/src/net/base/registry_controlled_domains/registry_controlled_domain.h
One more thing that I thought about today - do you rely on a stable mapping from email to username right now? What would happen if in the future you map those differently? Say new gTLDs appear or disappear or the rules what is a valid username change? I think you might need to store the current mapping somewhere or otherwise you will need to be able to probe older mappings and potentially run into collisions due to that.
There is a request that if the user does not remember that they created a local OS user based on their google account and sign in again with the credential provider, it should just work. Since the gaiaid<->local OS user mapping is stored on the machine, the plan is to use that. I think this mapping can also be used to handle changes in domain or email address.
When this happens though, the local OS username likely won't change though.
Comment 1 by rogerta@chromium.org
, Sep 18