diff --git a/lib/AccountManager/App.pm b/lib/AccountManager/App.pm index b00462ee69a5bdca4ebce8b01cdde30018e22939..f017125004601ef4f5a411836c73cf46b8859f6a 100644 --- a/lib/AccountManager/App.pm +++ b/lib/AccountManager/App.pm @@ -256,6 +256,7 @@ sub req_select_sp { my @federations = split(/, */, $self->{configuration}->{federations}->{list}); my %federations; + my @self_entities; foreach my $federation (@federations) { my $file = $self->get_metadata_file(federation => $federation); @@ -275,6 +276,25 @@ sub req_select_sp { label => $self->{configuration}->{$federation}->{label}, entities => $entities }; + + # if user is authenticated, and its IdP is found in metadata, + # push all entities with the same organization URL in a list + if ($ENV{HTTP_SHIB_IDENTITY_PROVIDER}) { + my $idp = $metadata->parse(entityid => $ENV{HTTP_SHIB_IDENTITY_PROVIDER}); + if ($idp) { + my $organization = $idp->organization(); + push @self_entities, + grep { $_->{organization} eq $organization } + @$entities; + } + } + } + + if (@self_entities) { + $federations{self} = { + label => $self->{lh}->maketext("My organization"), + entities => \@self_entities, + }; } $self->respond( diff --git a/lib/AccountManager/L10N/fr.pm b/lib/AccountManager/L10N/fr.pm index d0cdcc9ca95d1fd3d1b4a5ee564006d24a4eea9f..1a085a5b826e43b73f714083eba90984020c7e31 100644 --- a/lib/AccountManager/L10N/fr.pm +++ b/lib/AccountManager/L10N/fr.pm @@ -117,6 +117,10 @@ msgstr "Liste des attributs utilisateur" msgid "More information" msgstr "Plus d'information" +#: lib/AccountManager/App.pm:295 +msgid "My organization" +msgstr "Mon organisme" + #: templates/web/edugain/complete_challenge.tt2.html:29 templates/web/edugain/select_email.tt2.html:38 templates/web/edugain/select_sp.tt2.html:37 templates/web/renater/complete_challenge.tt2.html:29 templates/web/renater/select_email.tt2.html:38 templates/web/renater/select_sp.tt2.html:37 msgid "Next" msgstr "Suivant"