Skip to content

Commit

Permalink
Fixes issues with SAML attribute mapping (#11315)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hudell authored and rodrigok committed Jul 4, 2018
1 parent 851c93d commit ec377bd
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/meteor-accounts-saml/saml_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,7 @@ SAML.prototype.validateResponse = function(samlResponse, relayState, callback) {
if (attributes) {
attributes.forEach(function(attribute) {
const value = self.getElement(attribute, 'AttributeValue');
let key = attribute.$.Name.value;
key=key.replace(/\./g, '-');
const key = attribute.$.Name.value;
if (typeof value[0] === 'string') {
profile[key] = value[0];
} else {
Expand All @@ -422,6 +421,16 @@ SAML.prototype.validateResponse = function(samlResponse, relayState, callback) {
console.log(`NameID: ${ JSON.stringify(profile) }`);
}

const profileKeys = Object.keys(profile);
for (let i = 0; i < profileKeys.length; i++) {
const key = profileKeys[i];

if (key.match(/\./)) {
profile[key.replace(/\./g, '-')] = profile[key];
delete profile[key];
}
}

callback(null, profile, false);
} else {
const logoutResponse = self.getElement(doc, 'LogoutResponse');
Expand Down

0 comments on commit ec377bd

Please sign in to comment.