diff --git a/lib/AccountManager/WebRequest.pm b/lib/AccountManager/WebRequest.pm index 581111a50b06a2059fa302c5704cb2857eae6115..a1c978c23eac7350c46b35219661d2ce46ca6638 100644 --- a/lib/AccountManager/WebRequest.pm +++ b/lib/AccountManager/WebRequest.pm @@ -262,12 +262,20 @@ sub req_select_sp { } } - # replace metadata contacts from configuration contacts if defined + # override metadata contacts if needed my $entity = $self->{in}->{sp_entityid}; my $contacts = $self->{configuration}->{$entity}->{contacts} || $self->{configuration}->{service}->{contacts}; - $provider->contacts(split(/, */, $contacts)) if $contacts; + if ($contacts) { + if ($contacts =~ /^\+(.+)/) { + # complement original contacts + $provider->contacts($provider->contacts(), split(/, */, $1)); + } else { + # replace original contacts + $provider->contacts(split(/, */, $contacts)); + } + } $self->{out}->{provider} = $provider; $self->{out}->{subtitle} = 'Select your Service Provider'; @@ -303,12 +311,20 @@ sub req_generate_token { return; } - # replace metadata contacts from configuration contacts if defined + # override metadata contacts if needed my $entity = $self->{in}->{sp_entityid}; my $contacts = $self->{configuration}->{$entity}->{contacts} || $self->{configuration}->{service}->{contacts}; - $provider->contacts(split(/, */, $contacts)) if $contacts; + if ($contacts) { + if ($contacts =~ /^\+(.+)/) { + # complement original contacts + $provider->contacts($provider->contacts(), split(/, */, $1)); + } else { + # replace original contacts + $provider->contacts(split(/, */, $contacts)); + } + } ## Check that email_address is a known contact for this SP unless ($provider->is_contact($self->{in}->{email_address}))