From 4d85e9a6421c6cd288539ba78a8612e7fc776ff5 Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Wed, 18 Nov 2009 08:15:17 +0000
Subject: [PATCH] Auth_Simple: Add login()-function.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1998 44740490-163a-0410-bde0-09ae8108e29a
---
 lib/SimpleSAML/Auth/Simple.php | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)

diff --git a/lib/SimpleSAML/Auth/Simple.php b/lib/SimpleSAML/Auth/Simple.php
index 1e6b6bbd8..1b04ffeb7 100644
--- a/lib/SimpleSAML/Auth/Simple.php
+++ b/lib/SimpleSAML/Auth/Simple.php
@@ -54,11 +54,7 @@ class SimpleSAML_Auth_Simple {
 	 * current page.
 	 *
 	 * 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:
-	 *  - '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.
+	 * the authentication. See the login()-function for a description.
 	 *
 	 * @param array $params  Various options to the authentication request.
 	 */
@@ -71,6 +67,26 @@ class SimpleSAML_Auth_Simple {
 			return;
 		}
 
+		$this->login($params);
+	}
+
+
+	/**
+	 * Start an authentication process.
+	 *
+	 * This function never returns.
+	 *
+	 * 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:
+	 *  - '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.
+	 *
+	 * @param array $params  Various options to the authentication request.
+	 */
+	public function login(array $params = array()) {
+
 		if (array_key_exists('KeepPost', $params)) {
 			$keepPost = (bool)$params['KeepPost'];
 		} else {
@@ -96,6 +112,7 @@ class SimpleSAML_Auth_Simple {
 		$params[SimpleSAML_Auth_State::RESTART] = $restartURL;
 
 		SimpleSAML_Auth_Default::initLogin($this->authSource, $returnTo, NULL, $params);
+		assert('FALSE');
 	}
 
 
-- 
GitLab