PR #27 Honour multi-valued attrs

This commit is contained in:
Steffo Weber 2018-02-16 21:35:45 +01:00
parent 58b0ce6e08
commit 28965b536c
2 changed files with 11 additions and 2 deletions

View file

@ -1,7 +1,7 @@
Package.describe({
name:"steffo:meteor-accounts-saml",
summary: "SAML Login (SP) for Meteor. Works with OpenAM, OpenIDP and provides Single Logout.",
version: "0.0.14",
version: "0.0.15",
git: "https://github.com/steffow/meteor-accounts-saml.git"
});

View file

@ -431,7 +431,16 @@ SAML.prototype.validateResponse = function(samlResponse, relayState, callback) {
}
if (attributes) {
for (let i = 0; i < attributes.length; i++) {
const value = attributes[i].getElementsByTagNameNS('urn:oasis:names:tc:SAML:2.0:assertion', 'AttributeValue')[0];
const values = attributes[i].getElementsByTagNameNS('urn:oasis:names:tc:SAML:2.0:assertion', 'AttributeValue');
let value;
if (values.length === 1) {
value = values[0].textContent;
} else {
value = [];
for (var attributeValue of values) {
value.push(attributeValue.textContent);
}
}
if (Meteor.settings.debug) {
console.log("Name: " + attributes[i]);
console.log(`Adding attrinute from SAML response to profile:` + attributes[i].getAttribute('Name') + " = " + value.textContent);