From f14ae6cd4bfa105212605010ad09f2ef8ba72135 Mon Sep 17 00:00:00 2001 From: Soisik Froger Date: Thu, 5 Dec 2019 15:58:21 +0000 Subject: [PATCH] Manager API - fixed bug with exportedAttributes getting mixed up between saml sps #2034 --- .../lib/Lemonldap/NG/Manager/Api/Providers.pm | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Api/Providers.pm b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Api/Providers.pm index 7a5f906f9..b195ba6b6 100644 --- a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Api/Providers.pm +++ b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Api/Providers.pm @@ -234,8 +234,17 @@ sub _getSamlSp { my $metadata = $conf->{samlSPMetaDataXML}->{$confKey} ->{samlSPMetaDataXML}; + # Get options + my $options = $conf->{samlSPMetaDataOptions}->{$confKey}; + + my $samlSp = { + confKey => $confKey, + metadata => $metadata, + exportedAttributes => {}, + options => $options + }; + # Get exported attributes - my %exportedAttributes; foreach ( keys %{ $conf->{samlSPMetaDataExportedAttributes} @@ -251,29 +260,22 @@ sub _getSamlSp { $mandatory = !!$mandatory ? 'true' : 'false'; - $exportedAttributes->{$_} = { + $samlSp->{exportedAttributes}->{$_} = { name => $name, mandatory => $mandatory }; if (defined $friendly_name && $friendly_name ne '') { - $exportedAttributes->{$_}->{friendlyName} = $friendly_name; + $samlSp->{exportedAttributes}->{$_}->{friendlyName} = $friendly_name; } if (defined $format && $format ne '') { - $exportedAttributes->{$_}->{format} = $format; + $samlSp->{exportedAttributes}->{$_}->{format} = $format; } } - # Get options - my $options = $conf->{samlSPMetaDataOptions}->{$confKey}; - return { - confKey => $confKey, - metadata => $metadata, - exportedAttributes => $exportedAttributes, - options => $options - }; + return $samlSp; } 1;