diff --git a/modules/consent/lib/Auth/Process/Consent.php b/modules/consent/lib/Auth/Process/Consent.php
index a7c06e568b76acdff231fc9cfb9cc41bec599f0c..a20b75c0df099536dde30ab4c13b825d1b4f8c54 100644
--- a/modules/consent/lib/Auth/Process/Consent.php
+++ b/modules/consent/lib/Auth/Process/Consent.php
@@ -149,7 +149,6 @@ class sspmod_consent_Auth_Process_Consent extends SimpleSAML_Auth_ProcessingFilt
         assert('array_key_exists("entityid", $state["Source"])');
         assert('array_key_exists("metadata-set", $state["Source"])');
 
-        $session  = SimpleSAML_Session::getInstance(); 
         $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
 
         /**
@@ -161,10 +160,6 @@ class sspmod_consent_Auth_Process_Consent extends SimpleSAML_Auth_ProcessingFilt
         if (isset($state['saml:sp:IdP'])) {
             $idpmeta         = $metadata->getMetaData($state['saml:sp:IdP'], 'saml20-idp-remote');
             $state['Source'] = $idpmeta;
-        } elseif ($session->getIdP() !== null) {
-            // For backwards compatibility. TODO: Remove in version 1.8
-            $idpmeta         = $metadata->getMetaData($session->getIdP(), 'saml20-idp-remote');
-            $state['Source'] = $idpmeta;
         }
 
         if ($this->_store !== null) {