소스 검색

fix: use fullname from keycloak profile info with username as fallback (#1888)

Simon Lichtinghagen 5 년 전
부모
커밋
764d98fa1d
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. 5 1
      server/modules/authentication/keycloak/authentication.js

+ 5 - 1
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'