Change auto created username pattern

Due to oauth2 configs our users’ usernames emulate the email pattern user@domain.com. Home directories reflect the entire email address, i.e., jupyter-user@domain.com

I’d prefer to constrain usernames to just the user portion of the mail to the left of @. This would make it easier to login, eliminate uglier urls, etc.

Is there an easy way to achieve this? Does it require extending the User class?

You can subclass your authenticator class, and modify the returned username:
https://jupyterhub.readthedocs.io/en/stable/api/auth.html#jupyterhub.auth.Authenticator.authenticate