Change username (Oauth2 OIDC Azure)

Does anyone know how to “change” the username?
The case is:
The Azure account has the username “mail#abc@example.com” and we have “abc@example.com” in the database. The task is to match the account with the user in the database and don’t create a new user when they log in (currently the user can log in but it creates new user in database).
I checked the app and there are several times JMIX calls currentAuthentication.getUsername() to match the roles, query the table etc.
Can I change the username once they enter the app and make it globally used across the app?

Hi,

There is a setting that defines which attribute should be used as a username:

spring.security.oauth2.client.provider.keycloak.user-name-attribute=preferred_username