From 2cc5f5e19eb1039165564940a5a8e150dc2a5cf1 Mon Sep 17 00:00:00 2001
From: Patrick Stricker <stricker@hera.dev.iks-hagen.de>
Date: Thu, 13 Oct 2011 10:04:39 +0200
Subject: [PATCH] made work with http authentication kind of sso login

---
 index.php | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/index.php b/index.php
index 4e1f5bcc8d..937784694c 100644
--- a/index.php
+++ b/index.php
@@ -100,6 +100,18 @@ else {
 			$error = true;
 		}
 	}
-
+        // The user is already authenticated using Apaches AuthType Basic... very usable in combination with LDAP
+        elseif(isset($_SERVER["PHP_AUTH_USER"]) && isset($_SERVER["PHP_AUTH_PW"]))
+        {
+                if (OC_User::login($_SERVER["PHP_AUTH_USER"],$_SERVER["PHP_AUTH_PW"]))
+                {
+                        OC_User::unsetMagicInCookie();
+                        OC_Util::redirectToDefaultPage();
+                }
+                else
+                {
+                        $error = true;
+                }
+        }
 	OC_Template::printGuestPage('', 'login', array('error' => $error, 'redirect' => isset($_REQUEST['redirect_url'])?$_REQUEST['redirect_url']:'' ));
 }
-- 
GitLab