"Could not find the metadata of an IdP" with drupal and simplesamlphp_auth
<p>I set up my SimpleSamlPhp(I have my IdP in another server) with Drupal. After logging into "<a href="http://localhost:31478/simplesaml/" rel="noreferrer">http://localhost:31478/simplesaml/</a>" as administrator, I ran "Test authentication sources" with my IdP, the screen of "SAML 2.0 SP Demo Example" screen with correct attributes was displayed.  I guess it meant that SimpleSamlPhp and my Idp could see each other and were communicated properly.</p>

<p>However, when I tried to use Federated login with Drupal after turning on "Activate authentication via SimpleSAMLphp",I got the following error:</p>

<p><code>SimpleSAML_Error_Exception: Could not find the metadata of an IdP with entity ID 'tenant2.test.com' in sspmod_saml_Auth_Source_SP-&gt;getIdPMetadata() (line 134 of /var/www/vendor/simplesamlphp/simplesamlphp/modules/saml/lib/Auth/Source/SP.php).</code></p>

<p><strong>SETTINGS</strong></p>

<ul>
<li>Drupal version is 8.  </li>
<li>php version is 5.6.24-0.</li>
<li>simplesamlphp_auth module version is 8.x-3.0-alpha4+2-dev.</li>
<li>simplesamlphp_auth module was installed and enabled in Drupal.   "Authentication source for this SP" was set to "default-sp" for simplesamlphp_auth module configuration</li>
</ul>

<p>I have my simplesamlphp directory in /var.  The following changes were made for enabling saml</p>

<p><strong>/var/simplesamlphp/config/config.php</strong></p>

<pre><code>
    'baseurlpath' => 'simplesaml/',
    ....
    'enable.saml20-sp'  => true,
    'enable.saml20-idp' => true,
    'enable.shib13-idp' => false,
    'enable.adfs-idp' => false,
    'enable.wsfed-sp' => false,
    'enable.authmemcookie' => false,
    ....
    'saml' => TRUE,
    ....
    ....
    'default-saml20-idp' => 'tenant2.test.com',
    ....
    'store.type'                    => 'memcache',
    ....
    ....
    'memcache_store.servers' => array(
        array(
            array('hostname' => 'localhost'),
        ),
    ),
    'memcache_store.prefix' => 'SimpleSAMLphp',
    ....
    .... 
    'trusted.url.domains' => array('localhost:31478'),
</code></pre>

<p><strong>/var/simplesamlphp/config/authsources.php</strong></p>

<pre><code>
    &lt;?php
    $config = array(
        'admin' => array(
        'core:AdminPassword',
        ),

        'default-sp' => array(
            'saml:SP',
        'privatekey' => 'saml.pem',
        'certificate' => 'saml.crt',       
        'entityID' => null,
        'idp' => 'tenant2.test.com',  
        'discoURL' => null,
    ),

    );
    </code></pre>

<p><strong>/var/simplesamlphp/metadata/saml20-idp-remote.php</strong></p>

<pre><code>
    &lt;?php
        $metadata['tenant2.test.com'] = array(
            'SingleSignOnService'  => 'https://tenant2.test.com/testSamlLogin',
            'AssertionConsumerService' => 'http://localhost:31478/simplesaml/module.php/saml/sp/saml2-acs.php/default-sp',
            'SingleLogoutService'  => 'https://tenant2.test.com/admin/logout',
            'certFingerprint'      => '0a89aec59bf48e414ec050f6956891cb3f5b09a0',
        );
</code></pre>

<p>I have been trying to fix this problem for a few days.  Did I missing anything?   </p>

<p>Thank you.</p>