moodle-auth_saml2 icon indicating copy to clipboard operation
moodle-auth_saml2 copied to clipboard

The idp logo icon field is expected to have 'pix' and 'component' properties

Open leac opened this issue 4 years ago • 5 comments

What happened? After I installed and configured the plugin, I went to the login page and there was a button with the "SAMLtest IdP" text, and a broken image icon on it.

What I expected: I expected to see the IDP icon, but instead there was a broken image.

More data obout the error: When debug mode is on I also get 2 errors: ( ! ) Notice: Trying to get property 'pix' of non-object in /sandbox39/lib/authlib.php on line 749 ( ! ) Notice: Trying to get property 'component' of non-object in /sandbox39/lib/authlib.php on line 749

And when I go to that line, I see that indeed it does assume these properties exist:

$idp['iconurl'] = $output->image_url($idp['icon']->pix, $idp['icon']->component);

And there is a comment before that line:

// Pre-3.3 auth plugins provide icon as a pix_icon instance. New auth plugins (since 3.3) provide iconurl.

But the icon field coming from your plugin is an outside url, not divided into those properties.

What I've done in the meantime is changed the code in authlib.php, but of course that's not the correct solution for the long run:

 if (isset($idp['icon']->pix) && isset($idp['icon']->component)) {
        $idp['iconurl'] = $output->image_url($idp['icon']->pix, $idp['icon']->component);
 } else {
        $idp['iconurl'] = $idp['icon'];
 }

I was wondering if there's something that you could do in your plugin to address this issue.

leac avatar Sep 16 '20 11:09 leac

I am having this issue as well. I have a broken image on the button.

I am using the Boost Campus theme, although I suspect that it does not matter.

abatty avatar Mar 25 '21 06:03 abatty

Are you able to share the metadata xml, or at least the chunk which contains the image url?

brendanheywood avatar Mar 31 '21 02:03 brendanheywood

I'm in Japan, where the default answer for any question like that is "no," so I'm anonymizing the domain. I can confirm that the image link does work to display the image in a browser, and that I'm the only one on campus using the IdP who can't get the logo to load. I am, however, the only Moodle site running this plugin!

The chunk goes a little something like this:

<mdui:Logo height="50" width="50">https://idp.example.jp/idp/images/dummylogo.png</mdui:Logo>

All browsers except Safari display a broken image on the button; Safari seems to just suppress the whole thing when it doesn't find anything. I've tried just killing this line of the metadata, but it doesn't change anything.

abatty avatar Mar 31 '21 08:03 abatty

This could have fixed the above issue....

https://github.com/catalyst/moodle-auth_saml2/pull/424

danowar2k avatar Apr 01 '21 08:04 danowar2k

Experiencing issues in Totara 11+ as well, a custom logo completely breaks the login page.

image

xtractorab avatar Jun 23 '21 10:06 xtractorab