From 865593da54e6fee3c2a8db8da69148fc813bc250 Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Wed, 18 Nov 2009 08:15:27 +0000
Subject: [PATCH] Auth_Simple: Add errorURL parameter to login.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1999 44740490-163a-0410-bde0-09ae8108e29a
---
 lib/SimpleSAML/Auth/Simple.php | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/SimpleSAML/Auth/Simple.php b/lib/SimpleSAML/Auth/Simple.php
index 1b04ffeb7..fb36bf83d 100644
--- a/lib/SimpleSAML/Auth/Simple.php
+++ b/lib/SimpleSAML/Auth/Simple.php
@@ -79,6 +79,7 @@ class SimpleSAML_Auth_Simple {
 	 * This function accepts an array $params, which controls some parts of
 	 * the authentication. The accepted parameters depends on the authentication
 	 * source being used. Some parameters are generic:
+	 *  - 'ErrorURL': An URL that should receive errors from the authentication.
 	 *  - 'KeepPost': If the current request is a POST request, keep the POST
 	 *    data until after the authentication.
 	 *  - 'ReturnTo': The URL the user should be returned to after authentication.
@@ -103,6 +104,13 @@ class SimpleSAML_Auth_Simple {
 			$returnTo = SimpleSAML_Utilities::createPostRedirectLink($returnTo, $_POST);
 		}
 
+		if (array_key_exists('ErrorURL', $params)) {
+			$errorURL = (string)$params['ErrorURL'];
+		} else {
+			$errorURL = NULL;
+		}
+
+
 		/*
 		 * An URL to restart the authentication, in case the user bookmarks
 		 * something, e.g. the discovery service page.
@@ -111,7 +119,7 @@ class SimpleSAML_Auth_Simple {
 
 		$params[SimpleSAML_Auth_State::RESTART] = $restartURL;
 
-		SimpleSAML_Auth_Default::initLogin($this->authSource, $returnTo, NULL, $params);
+		SimpleSAML_Auth_Default::initLogin($this->authSource, $returnTo, $errorURL, $params);
 		assert('FALSE');
 	}
 
-- 
GitLab