Added displayname handling to SAML strategy

This commit is contained in:
Антон Мороз 2022-11-06 09:50:24 +03:00
parent 40e19f0764
commit c1b59294cf

View File

@ -7157,7 +7157,11 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
parent.debug('authlog', 'SAML profile: ' + JSON.stringify(profile, null, 4));
if (typeof profile.nameID != 'string') { return done(); }
var user = { sid: '~saml:' + profile.nameID, name: profile.nameID, strategy: 'saml' };
if ((typeof profile.firstname == 'string') && (typeof profile.lastname == 'string')) { user.name = profile.firstname + ' ' + profile.lastname; }
if (typeof profile.displayname == 'string') {
user.name = profile.displayname;
} else if ((typeof profile.firstname == 'string') && (typeof profile.lastname == 'string')) {
user.name = profile.firstname + ' ' + profile.lastname;
}
if (typeof profile.email == 'string') { user.email = profile.email; }
return done(null, user);
}