diff --git a/modules/saml/lib/Auth/Source/SP.php b/modules/saml/lib/Auth/Source/SP.php
index 9f39475d63d6d4ed95110be8dd77be119af7479a..20b8e486c742bfc41dce99553e30486e12b408be 100644
--- a/modules/saml/lib/Auth/Source/SP.php
+++ b/modules/saml/lib/Auth/Source/SP.php
@@ -257,12 +257,27 @@ class sspmod_saml_Auth_Source_SP extends SimpleSAML_Auth_Source {
 
 		SimpleSAML_Logger::debug('Sending SAML 2 AuthnRequest to ' . var_export($idpMetadata->getString('entityid'), TRUE));
 		$b = new SAML2_HTTPRedirect();
-		$b->send($ar);
+		$this->sendSAML2AuthnRequest($state, $b, $ar);
 
 		assert('FALSE');
 	}
 
 
+	/**
+	 * Function to actually send the authentication request.
+	 *
+	 * This function does not return.
+	 *
+	 * @param array &$state  The state array.
+	 * @param SAML2_Binding $binding  The binding.
+	 * @param SAML2_AuthnRequest  $ar  The authentication request.
+	 */
+	public function sendSAML2AuthnRequest(array &$state, SAML2_Binding $binding, SAML2_AuthnRequest $ar) {
+		$binding->send($ar);
+		assert('FALSE');
+	}
+
+
 	/**
 	 * Send a SSO request to an IdP.
 	 *