Remove domain part from username with google identity provider

Hello,

I am trying to trim the username sent by Google Identity Provider so that it doesn’t contain the domain part. So:

forename.familyname@gmail.comforename.familyname

In the Identity Provider Mappers section I can see that I can map various attributes that Google sends to a user attribute.

Google sends “given_name” and “family_name” attributes, but in Mapper I can only use one or the other in Social Profile JSON Field Path. Is there a way to get the syntax right? Is this at all possible? Or do I have to do it in a different way?

I see that the javascript Mapper Type has been removed for quite a while now, so I guessing people approach this in a different way.

Any advice is greatly appreciated!

I’m using keycloak 25.0.2 directly installed on the host (Ubuntu 24.04)

Ok, I’ve got it. In order to make it work, you need to choose Username Template Importer in the “Mapper Type”.
Then in the “Template” field you have to add this:

${CLAIM.given_name}.${CLAIM.family_name}

And this works for Google.
The target can be “LOCAL”. At least this works for me.