From 7050b74a2f8409545864d097cf36ecb5faf168cc Mon Sep 17 00:00:00 2001
From: Tim Steiner <tsteiner2@unl.edu>
Date: Fri, 6 Mar 2009 16:14:56 +0000
Subject: [PATCH] Change login to use CAS instead of LDAP

---
 .../auth/controllers/IndexController.php      | 20 +++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/application/modules/auth/controllers/IndexController.php b/application/modules/auth/controllers/IndexController.php
index c3c552fc..49b86351 100644
--- a/application/modules/auth/controllers/IndexController.php
+++ b/application/modules/auth/controllers/IndexController.php
@@ -18,6 +18,9 @@ class Auth_IndexController extends App_Controller_Action {
 	
 	public function loginAction()
 	{
+        $this->_redirect('/auth/index/validate');
+        return;
+        
 		$session = new Zend_Session_Namespace(__CLASS__);
 		$this->view->errorMessage = $session->errorMessage;
 		unset($session->errorMessage);
@@ -36,12 +39,21 @@ class Auth_IndexController extends App_Controller_Action {
 		
 		$auth = Unl_Auth::getInstance();
 		
-		$ldap = new Unl_Ldap('ldap://localhost:10389');
-		$ldapAdapter = new Unl_Auth_Adapter_Ldap($ldap, $username, $password);
-		$auth->pushAdapter($ldapAdapter);
+		//$ldap = new Unl_Ldap('ldap://localhost:10389');
+		//$ldapAdapter = new Unl_Auth_Adapter_Ldap($ldap, $username, $password);
+		//$auth->pushAdapter($ldapAdapter);
+		
+		if ($_SERVER['HTTPS'] == 'on') {
+		    $serviceUrl = 'https://';
+		} else {
+		    $serviceUrl = 'http://';
+		}
+		$serviceUrl .= $_SERVER['SERVER_NAME'] . Zend_Controller_Front::getInstance()->getBaseUrl() . '/auth/index/validate';
+		$casAdapter = new Unl_Auth_Adapter_Cas($serviceUrl, 'https://login.unl.edu/cas', $this->_getParam('ticket'));
+		$auth->pushAdapter($casAdapter);
 		
 		try {
-			$result = $auth->authenticate($ldapAdapter);
+			$result = $auth->authenticate();
 		} catch (Exception $e) {
 			//
 		}
-- 
GitLab