When multiple IdP's are setup in Moodle/Totara and an IdP initiated request comes in from the second configured IdP it fails producing an error like below:
SAML2 exception: Cannot retrieve metadata for IdP '<IdP URL>' because it isn't a valid IdP for this SP.
When multiple IdP's are setup in Moodle/Totara and an IdP initiated request comes in from the second configured IdP it fails producing an error like below:
SAML2 exception: Cannot retrieve metadata for IdP '<IdP URL>' because it isn't a valid IdP for this SP.
After doing some debugging/testing, it was traced down to this line of custom code in the simplesamlphp lib: https://github.com/catalyst/moodle-auth_saml2/blob/MOODLE_39_STABLE/.extlib/simplesamlphp/modules/saml/src/Auth/Source/SP.php#L312
The data this for loops expects is in a different format now, thus never setting
$this->idp
to null and throwing the error below.