From 5d0eae6808b208457bb394d1c1c8632a724c0fea Mon Sep 17 00:00:00 2001
From: Guillaume Rousse <guillaume.rousse@renater.fr>
Date: Wed, 5 Dec 2018 17:24:23 +0100
Subject: [PATCH] fix user IdP lookup

---
 lib/AccountManager/App.pm | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/AccountManager/App.pm b/lib/AccountManager/App.pm
index f017125..99dc1c1 100644
--- a/lib/AccountManager/App.pm
+++ b/lib/AccountManager/App.pm
@@ -280,9 +280,15 @@ sub req_select_sp {
         # 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});
+            my $idps = $metadata->parse(id => $ENV{HTTP_SHIB_IDENTITY_PROVIDER});
+            my $idp  = $idps->[0];
             if ($idp) {
-                my $organization = $idp->organization();
+                $self->{logger}->debugf(
+		    "idp %s found in federation %s metadata",
+		    $ENV{HTTP_SHIB_IDENTITY_PROVIDER},
+		    $federation
+		);
+                my $organization = $idp->{organization};
                 push @self_entities,
                     grep { $_->{organization} eq $organization }
                     @$entities;
-- 
GitLab