From 091ab0e2915579fa175b409efcd787ee9ff68a08 Mon Sep 17 00:00:00 2001 From: Aaron Ogle Date: Thu, 24 Mar 2022 13:39:58 -0500 Subject: [PATCH] [FIX] Force name to string (#24930) * Force name and email to string If its ever anything but a string. Like an array for example It borks the user list because of the aggregations done to bring in users * Removed force to string for email Downstream user creation logic handles this so its safe to let go as is * Log number of values received per attribute * Allow multiple emails Co-authored-by: Pierre Lehnen --- app/meteor-accounts-saml/server/lib/Utils.ts | 2 +- app/meteor-accounts-saml/server/lib/parsers/Response.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/meteor-accounts-saml/server/lib/Utils.ts b/app/meteor-accounts-saml/server/lib/Utils.ts index a07f5c5de23..2461e4d73b6 100644 --- a/app/meteor-accounts-saml/server/lib/Utils.ts +++ b/app/meteor-accounts-saml/server/lib/Utils.ts @@ -430,7 +430,7 @@ export class SAMLUtils { } const email = this.getProfileValue(profile, userDataMap.email); const profileUsername = this.getProfileValue(profile, userDataMap.username, true); - const name = this.getProfileValue(profile, userDataMap.name); + const name = this.getProfileValue(profile, userDataMap.name, true); // Even if we're not using the email to identify the user, it is still mandatory because it's a mandatory information on Rocket.Chat if (!email) { diff --git a/app/meteor-accounts-saml/server/lib/parsers/Response.ts b/app/meteor-accounts-saml/server/lib/parsers/Response.ts index ee1172b0648..bf92043a597 100644 --- a/app/meteor-accounts-saml/server/lib/parsers/Response.ts +++ b/app/meteor-accounts-saml/server/lib/parsers/Response.ts @@ -403,7 +403,7 @@ export class ResponseParser { const key = attributes[i].getAttribute('Name'); if (key) { - SAMLUtils.log(`Name: ${attributes[i]}`); + SAMLUtils.log(`Attribute: ${attributes[i]} has ${values.length} value(s).`); SAMLUtils.log(`Adding attribute from SAML response to profile: ${key} = ${value}`); profile[key] = value; }