Hello,
We are currently using this plugin https://moodle.org/plugins/auth_saml2
So we successfully make SAML work on our LMS, however every day we keep on getting this error "Could not find the metadata of an IdP with entity ID 'localhost', but if we resave the settings (with the same config) it will work again with no error. Then the next day we will receive again the same issue.
I was thinking, maybe because of server cache? (Not sure though) Since I also did this scenario where SAML is working on our LMS no errors, then I remove the IDP metadata details then tried to log in again, but I did not receive any error and I successfully log in.
I checked on the backend where the error is being thrown and found this
Directory : /saml2/extlib/simplesamlphp/modules/saml/lib/Auth/Source/SP.php
Line 108-136
public function getIdPMetadata($entityId) {
assert('is_string($entityId)');
if ($this->idp !== NULL && $this->idp !== $entityId) {
throw new SimpleSAML_Error_Exception('Cannot retrieve metadata for IdP ' . var_export($entityId, TRUE) .
' because it isn\'t a valid IdP for this SP.');
}
$metadataHandler = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
// First, look in saml20-idp-remote.
try {
return $metadataHandler->getMetaDataConfig($entityId, 'saml20-idp-remote');
} catch (Exception $e) {
/* Metadata wasn't found. */
SimpleSAML\Logger::debug('getIdpMetadata: ' . $e->getMessage());
}
/* Not found in saml20-idp-remote, look in shib13-idp-remote. */
try {
return $metadataHandler->getMetaDataConfig($entityId, 'shib13-idp-remote');
} catch (Exception $e) {
/* Metadata wasn't found. */
SimpleSAML\Logger::debug('getIdpMetadata: ' . $e->getMessage());
}
/* Not found. */
throw new SimpleSAML_Error_Exception('Could not find the metadata of an IdP with entity ID ' . var_export($entityId, TRUE));
}
I found two options the code is trying to look to get the metadata config, I was thinking that maybe there's another option that can be added to the code that can cater to the problem above.
Thanks for the help.