From documentation
proxy.keycloak.name-attribute: name of the attribute to use as the user's name;
one of name (default, current behaviour), preferred_username, nickname or email
in the default keycloak token mapping preferred_username
is the username of the keycloak user.
So set in your application.yml
keycloak:
...
name-attribute: preferred_username
If this does not work, you can always remove existing token mappers for name
(a few token mappers a pre defined in client_scopes) and create a token mapper with the following config
- type: User Property
- property: username
- Token Claim Name: name
- ID/Access/User-Info: on
Now Keycloak tokens will contain a attribute name
with the value of users username