I am using Shinyproxy with Keycloak and read the username with
userName <- Sys.getenv("SHINYPROXY_USERNAME")
Unfortunately I receive a concatenation of FirstName and LastName, which is not unique.
I would like to have the username in SHINYPROXY_USERNAME. Is this a Keycloak configuration issue?
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
Now Keycloak tokens will contain a attribute name
with the value of users username