Merge pull request #4722 from AntonAndreevichMoroz/master

Added displayname handling to SAML strategy
This commit is contained in:
Ylian Saint-Hilaire 2022-11-06 09:23:13 -08:00 committed by GitHub
commit a90d59dc28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

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);
}