catalyst / moodle-auth_saml2

SAML done 100% in Moodle, fast, simple, secure
https://moodle.org/plugins/auth_saml2
70 stars 132 forks source link

IdP Initiated login failing since update to SimpleSAMLPHP 2.0.5 #801

Closed jwalits closed 4 months ago

jwalits commented 4 months ago

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.