From 764d98fa1d992ccdf335f763121b90bc442baca9 Mon Sep 17 00:00:00 2001 From: Simon Lichtinghagen <2264757+silicht@users.noreply.github.com> Date: Fri, 15 May 2020 19:28:55 +0200 Subject: [PATCH] fix: use fullname from keycloak profile info with username as fallback (#1888) --- server/modules/authentication/keycloak/authentication.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/modules/authentication/keycloak/authentication.js b/server/modules/authentication/keycloak/authentication.js index d2bab738..9126b38f 100644 --- a/server/modules/authentication/keycloak/authentication.js +++ b/server/modules/authentication/keycloak/authentication.js @@ -21,12 +21,16 @@ module.exports = { clientSecret: conf.clientSecret, callbackURL: conf.callbackURL }, async (accessToken, refreshToken, profile, cb) => { + let displayName = profile.username + if (_.isString(profile.fullName) && profile.fullName.length > 0) { + displayName = profile.fullName + } try { const user = await WIKI.models.users.processProfile({ profile: { id: profile.keycloakId, email: profile.email, - name: profile.username, + name: displayName, picture: '' }, providerKey: 'keycloak'