[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 <pierre.lehnen@rocket.chat>
pull/24936/head
Aaron Ogle 4 years ago committed by GitHub
parent cded5b8e53
commit 091ab0e291
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/meteor-accounts-saml/server/lib/Utils.ts
  2. 2
      app/meteor-accounts-saml/server/lib/parsers/Response.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) {

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

Loading…
Cancel
Save