From c1b59294cfe318f5de113db1e7a2080aef6b735a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D1=82=D0=BE=D0=BD=20=D0=9C=D0=BE=D1=80=D0=BE?= =?UTF-8?q?=D0=B7?= Date: Sun, 6 Nov 2022 09:50:24 +0300 Subject: [PATCH] Added displayname handling to SAML strategy --- webserver.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/webserver.js b/webserver.js index 3721e5c8..df4d5b94 100644 --- a/webserver.js +++ b/webserver.js @@ -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); }