Added displayname handling to SAML strategy
Антон Мороз committed
Nov 6, 2022 at 09:50 UTC
c1b59294cfe318f5de113db1e7a2080aef6b735a
1 file changed
+5
-1
webserver.js
+5
-1
@@ -7157,7 +7157,11 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
7157
parent.debug('authlog', 'SAML profile: ' + JSON.stringify(profile, null, 4));
7158
if (typeof profile.nameID != 'string') { return done(); }
7159
var user = { sid: '~saml:' + profile.nameID, name: profile.nameID, strategy: 'saml' };
7160
- if ((typeof profile.firstname == 'string') && (typeof profile.lastname == 'string')) { user.name = profile.firstname + ' ' + profile.lastname; }
7160
+ if (typeof profile.displayname == 'string') {
7161
+ user.name = profile.displayname;
7162
+ } else if ((typeof profile.firstname == 'string') && (typeof profile.lastname == 'string')) {
7163
+ user.name = profile.firstname + ' ' + profile.lastname;
7164
+ }
7165
if (typeof profile.email == 'string') { user.email = profile.email; }
7166
return done(null, user);
7167
}