diff --git a/lib/.pear2registry b/lib/.pear2registry
index f730b57a291602618899cfcdfef23bcfe028b6d2..4b735cd904fc772daa7efb34c00e940528978569 100644
Binary files a/lib/.pear2registry and b/lib/.pear2registry differ
diff --git a/lib/.xmlregistry/channels/channel-simplecas.googlecode.com##svn.xml b/lib/.xmlregistry/channels/channel-simplecas.googlecode.com##svn.xml
new file mode 100644
index 0000000000000000000000000000000000000000..8de923b8b5f085d6281cd2da4b868b98c8b1603b
--- /dev/null
+++ b/lib/.xmlregistry/channels/channel-simplecas.googlecode.com##svn.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<channel version="1.0" xmlns="http://pear.php.net/channel-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/channel-1.0 http://pear.php.net/dtd/channel-1.0.xsd">
+ <name>simplecas.googlecode.com/svn</name>
+ <suggestedalias>simplecas</suggestedalias>
+ <summary>simplecas</summary>
+ <servers>
+ <primary>
+ <rest>
+ <baseurl type="REST1.0">http://simplecas.googlecode.com/svn/rest/</baseurl>
+ <baseurl type="REST1.1">http://simplecas.googlecode.com/svn/rest/</baseurl>
+ <baseurl type="REST1.3">http://simplecas.googlecode.com/svn/rest/</baseurl>
+ </rest>
+ </primary>
+ </servers>
+</channel>
diff --git a/lib/.xmlregistry/channels/channelalias-simplecas.txt b/lib/.xmlregistry/channels/channelalias-simplecas.txt
new file mode 100644
index 0000000000000000000000000000000000000000..fdae489857385937081e3051151920aa6c6e6422
--- /dev/null
+++ b/lib/.xmlregistry/channels/channelalias-simplecas.txt
@@ -0,0 +1 @@
+simplecas.googlecode.com/svn
\ No newline at end of file
diff --git a/lib/.xmlregistry/packages/pear.unl.edu/UNL_Auth/0.3.2-info.xml b/lib/.xmlregistry/packages/pear.unl.edu/UNL_Auth/0.3.2-info.xml
new file mode 100644
index 0000000000000000000000000000000000000000..f26b986f99de2f98d511bde5fa937c16738454e2
--- /dev/null
+++ b/lib/.xmlregistry/packages/pear.unl.edu/UNL_Auth/0.3.2-info.xml
@@ -0,0 +1,163 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<package xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" packagerversion="1.8.0alpha1" version="2.0" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
+ <name>UNL_Auth</name>
+ <channel>pear.unl.edu</channel>
+ <summary>An authentication framework for PHP Applications at UNL</summary>
+ <description>This package provides an authentication framework for web
+applications developed at UNL.</description>
+ <lead>
+ <name>Brett Bieber</name>
+ <user>saltybeagle</user>
+ <email>brett.bieber@gmail.com</email>
+ <active>yes</active>
+ </lead>
+ <date>2009-11-29</date>
+ <time>07:56:32</time>
+ <version>
+ <release>0.3.2</release>
+ <api>0.3.0</api>
+ </version>
+ <stability>
+ <release>alpha</release>
+ <api>alpha</api>
+ </stability>
+ <license uri="http://www1.unl.edu/wdn/wiki/Software_License">BSD License</license>
+ <notes>
+* Increase SimpleCAS dependency of 0.3.0 to use new object names and array options for the constructor.
+ </notes>
+ <contents>
+ <dir name="/">
+ <file baseinstalldir="/" md5sum="b7a35f1bfe174ef2725733df1539f212" name="UNL/Auth/SimpleCAS/ZendAuth.php" role="php"/>
+ <file baseinstalldir="/" md5sum="6def037a77fd9fa49bcc5e752cbb8170" name="UNL/Auth/SimpleCAS.php" role="php"/>
+ <file baseinstalldir="/" md5sum="ada4bb738641430ba2420da94ec3e749" name="UNL/Auth/CAS/PEARAuth.php" role="php"/>
+ <file baseinstalldir="/" md5sum="76deaf815ba781ca6f7f6bbcc7095912" name="UNL/Auth/CAS.php" role="php"/>
+ <file baseinstalldir="/" md5sum="f23e61f13d36579cc5f86e8c1a376392" name="UNL/Auth.php" role="php"/>
+ <file baseinstalldir="/" md5sum="c4ee1094cd276ff40fbd2b16d66068fe" name="docs/examples/Zend_SimpleCAS_example.php" role="doc"/>
+ <file baseinstalldir="/" md5sum="3a80ba084e5bc5f8b17d188b15e6a7aa" name="docs/examples/SimpleCAS_example.php" role="doc"/>
+ <file baseinstalldir="/" md5sum="3759e0e8f63d4161653c158b08cdd0ed" name="docs/examples/CAS_example.php" role="doc"/>
+ <file baseinstalldir="/" md5sum="e89e49dca8497ec59459d17140c6e63a" name="docs/examples/CASPEARAuth_example.php" role="doc"/>
+ </dir>
+ </contents>
+ <dependencies>
+ <required>
+ <php>
+ <min>5.1.2</min>
+ </php>
+ <pearinstaller>
+ <min>1.4.3</min>
+ </pearinstaller>
+ </required>
+ <optional>
+ <package>
+ <name>Auth</name>
+ <channel>pear.php.net</channel>
+ <min>1.0</min>
+ </package>
+ <package>
+ <name>CAS</name>
+ <channel>pear.unl.edu</channel>
+ <min>1.0.0</min>
+ </package>
+ <package>
+ <name>SimpleCAS</name>
+ <channel>simplecas.googlecode.com/svn</channel>
+ <min>0.3.0</min>
+ </package>
+ </optional>
+ </dependencies>
+ <phprelease>
+ <changelog>
+ <release>
+ <version>
+ <release>0.1.0</release>
+ <api>0.1.0</api>
+ </version>
+ <stability>
+ <release>alpha</release>
+ <api>alpha</api>
+ </stability>
+ <date>2007-12-17</date>
+ <license uri="http://www1.unl.edu/wdn/wiki/Software_License">BSD License</license>
+ <notes>
+First Release - only CAS is available.
+ </notes>
+ </release>
+ <release>
+ <version>
+ <release>0.1.1</release>
+ <api>0.1.1</api>
+ </version>
+ <stability>
+ <release>alpha</release>
+ <api>alpha</api>
+ </stability>
+ <date>2008-05-20</date>
+ <license uri="http://www1.unl.edu/wdn/wiki/Software_License">BSD License</license>
+ <notes>
+* Check if session is already started - kabel
+* Improve PHP docs and fix example. - bbieber
+ </notes>
+ </release>
+ <release>
+ <version>
+ <release>0.2.0</release>
+ <api>0.2.0</api>
+ </version>
+ <stability>
+ <release>alpha</release>
+ <api>alpha</api>
+ </stability>
+ <date>2008-08-22</date>
+ <license uri="http://www1.unl.edu/wdn/wiki/Software_License">BSD License</license>
+ <notes>
+* Upgrade CAS driver dependency to 1.0.0
+ </notes>
+ </release>
+ <release>
+ <version>
+ <release>0.3.0</release>
+ <api>0.3.0</api>
+ </version>
+ <stability>
+ <release>alpha</release>
+ <api>alpha</api>
+ </stability>
+ <date>2008-12-09</date>
+ <license uri="http://www1.unl.edu/wdn/wiki/Software_License">BSD License</license>
+ <notes>
+* Enable SimpleCAS support. http://code.google.com/p/simplecas/
+ </notes>
+ </release>
+ <release>
+ <version>
+ <release>0.3.1</release>
+ <api>0.3.0</api>
+ </version>
+ <stability>
+ <release>alpha</release>
+ <api>alpha</api>
+ </stability>
+ <date>2009-02-12</date>
+ <license uri="http://www1.unl.edu/wdn/wiki/Software_License">BSD License</license>
+ <notes>
+* Increase SimpleCAS dependency of 0.2.0 to take advantage of getRequest() so we can ignore the ssl peer verification.
+ </notes>
+ </release>
+ <release>
+ <version>
+ <release>0.3.2</release>
+ <api>0.3.0</api>
+ </version>
+ <stability>
+ <release>alpha</release>
+ <api>alpha</api>
+ </stability>
+ <date>2009-03-03</date>
+ <license uri="http://www1.unl.edu/wdn/wiki/Software_License">BSD License</license>
+ <notes>
+* Increase SimpleCAS dependency of 0.3.0 to use new object names and array options for the constructor.
+ </notes>
+ </release>
+ </changelog>
+ </phprelease>
+</package>
diff --git a/lib/docs/UNL_Auth/docs/examples/CASPEARAuth_example.php b/lib/docs/UNL_Auth/docs/examples/CASPEARAuth_example.php
new file mode 100644
index 0000000000000000000000000000000000000000..8b2442757e45a7bf08ad841e36e340859292363a
--- /dev/null
+++ b/lib/docs/UNL_Auth/docs/examples/CASPEARAuth_example.php
@@ -0,0 +1,26 @@
+<?php
+ini_set('display_errors', true);
+error_reporting(E_ALL);
+chdir(dirname(__FILE__).'/../../');
+require_once 'UNL/Auth.php';
+
+//$auth = UNL_Auth::PEARFactory('CAS', $options=null, $loginfunction=null, false);
+$auth = UNL_Auth::PEARFactory('CAS');
+$auth->start();
+
+if (isset($_GET['logout']) && $auth->checkAuth()) {
+ $auth->logout();
+ $auth->start();
+}
+
+if ($auth->checkAuth()) {
+ /*
+ * The output of your site goes here.
+ */
+ echo 'You are authenticated, '.$auth->getUsername().'<br />';
+ echo '<a href="?logout">Logout</a>';
+} else {
+ echo 'You need to log in bro!';
+}
+
+?>
\ No newline at end of file
diff --git a/lib/docs/UNL_Auth/docs/examples/CAS_example.php b/lib/docs/UNL_Auth/docs/examples/CAS_example.php
new file mode 100644
index 0000000000000000000000000000000000000000..42acfc6dff5776434521d352519b0d0cc3c91160
--- /dev/null
+++ b/lib/docs/UNL_Auth/docs/examples/CAS_example.php
@@ -0,0 +1,22 @@
+<?php
+ini_set('display_errors', true);
+error_reporting(E_ALL);
+chdir(dirname(__FILE__).'/../../');
+require_once 'UNL/Auth.php';
+
+$auth = UNL_Auth::factory('CAS');
+
+if (isset($_GET['login'])) {
+ $auth->login();
+} elseif (isset($_GET['logout'])) {
+ $auth->logout();
+}
+
+if (!$auth->isLoggedIn()) {
+ // Could call $auth->login() here to get the party started.
+ echo "You are not logged in.\n<br />\n";
+ echo '<a href="?login=true">Click here to log in!</a>';
+} else {
+ echo "You are logged in as {$auth->getUser()}<br />";
+ echo "<a href='?logout'>logout</a>";
+}
diff --git a/lib/docs/UNL_Auth/docs/examples/SimpleCAS_example.php b/lib/docs/UNL_Auth/docs/examples/SimpleCAS_example.php
new file mode 100644
index 0000000000000000000000000000000000000000..d514e53980d381ea273aaa4aa3fec1be787c2636
--- /dev/null
+++ b/lib/docs/UNL_Auth/docs/examples/SimpleCAS_example.php
@@ -0,0 +1,22 @@
+<?php
+ini_set('display_errors', true);
+error_reporting(E_ALL);
+chdir(dirname(__FILE__).'/../../');
+require_once 'UNL/Auth.php';
+
+$auth = UNL_Auth::factory('SimpleCAS');
+
+if (isset($_GET['login'])) {
+ $auth->login();
+} elseif (isset($_GET['logout'])) {
+ $auth->logout();
+}
+
+if (!$auth->isLoggedIn()) {
+ // Could call $auth->login() here to get the party started.
+ echo "You are not logged in.\n<br />\n";
+ echo '<a href="?login=true">Click here to log in!</a>';
+} else {
+ echo "You are logged in as {$auth->getUser()}<br />";
+ echo "<a href='?logout'>logout</a>";
+}
\ No newline at end of file
diff --git a/lib/docs/UNL_Auth/docs/examples/Zend_SimpleCAS_example.php b/lib/docs/UNL_Auth/docs/examples/Zend_SimpleCAS_example.php
new file mode 100644
index 0000000000000000000000000000000000000000..adac078d28164bb35aa64c3727a047378b9eac59
--- /dev/null
+++ b/lib/docs/UNL_Auth/docs/examples/Zend_SimpleCAS_example.php
@@ -0,0 +1,26 @@
+<?php
+ini_set('display_errors', true);
+error_reporting(E_ALL);
+chdir(dirname(__FILE__).'/../../');
+require_once 'UNL/Auth.php';
+require_once 'Zend/Auth.php';
+
+$auth = Zend_Auth::getInstance();
+$authAdapter = UNL_Auth::ZendFactory('SimpleCAS');
+if (!$auth->hasIdentity()) {
+ $result = $auth->authenticate($authAdapter);
+ if (!$result->isValid()) {
+ // Authentication failed; print the reasons why
+ foreach ($result->getMessages() as $message) {
+ echo "$message\n";
+ }
+ } else {
+ // Authentication succeeded; the identity ($username) is stored
+ // in the session
+ // $result->getIdentity() === $auth->getIdentity()
+ echo 'Hello '.$result->getIdentity();
+ }
+} else {
+ echo 'Hello@';
+}
+
diff --git a/lib/php/UNL/Auth.php b/lib/php/UNL/Auth.php
new file mode 100644
index 0000000000000000000000000000000000000000..a7ac0f33b42016026e68a321c2dc734b787c9302
--- /dev/null
+++ b/lib/php/UNL/Auth.php
@@ -0,0 +1,118 @@
+<?php
+/**
+ * This is a generic authentication framework for UNL which will return customized
+ * containers for use at UNL.
+ *
+ * <code>
+ * <?php
+ * require_once 'UNL/Auth.php';
+ * $a = UNL_Auth::factory('CAS');
+ * if ($a->isLoggedIn()) {
+ * echo 'Hello ' . $a->getUser();
+ * } else {
+ * echo 'Sorry, you must log in.';
+ * }
+ * </code>
+ *
+ * PHP version 5
+ *
+ * @category Authentication
+ * @package UNL_Auth
+ * @author Brett Bieber <brett.bieber@gmail.com>
+ * @copyright 2008 Regents of the University of Nebraska
+ * @license http://www1.unl.edu/wdn/wiki/Software_License BSD License
+ * @link http://pear.unl.edu/package/UNL_Auth
+ */
+class UNL_Auth
+{
+ protected static $_instance = null;
+
+ public static function getInstance()
+ {
+ if (null === self::$_instance) {
+ self::$_instance = new self();
+ }
+
+ return self::$_instance;
+ }
+
+ private function __construct()
+ {}
+
+ private function __clone()
+ {}
+
+ /**
+ * Abstract factory, used to get drivers for any of the authentication methods
+ * on campus.
+ *
+ * @param string $auth_type CAS, LDAP, LotusNotes, etc
+ * @param mixed $options Options for the specific container
+ *
+ * @return mixed
+ */
+ public function factory($auth_type, $options = null)
+ {
+ $auth_class = 'UNL_Auth_'.$auth_type;
+ $class_file = dirname(__FILE__).'/Auth/'.$auth_type.'.php';
+ return self::discoverAndReturn($auth_class, $class_file, $options);
+ }
+
+ /**
+ * Returns an auth container for use with systems compatible with PEAR Auth
+ *
+ * @param string $auth_type CAS, LDAP, LotusNotes, etc
+ * @param mixed $options Options for the container
+ *
+ * @return mixed
+ */
+ public function PEARFactory($auth_type, $options = null, $loginFunction = null, $showLogin = true)
+ {
+ require_once 'Auth/Auth.php';
+ /// Get the class... return the pear auth container.
+ $auth_class = 'UNL_Auth_'.$auth_type.'_PEARAuth';
+ $class_file = dirname(__FILE__).'/Auth/'.$auth_type.'/PEARAuth.php';
+ $container = self::discoverAndReturn($auth_class, $class_file, $options);
+ return $container->getPEARAuth($options, $loginFunction, $showLogin);
+ }
+
+ public function ZendFactory($auth_type, $options = null)
+ {
+ throw new Exception('not implemented yet!');
+ /// Get the class name, return the Zend Auth extended class
+ $auth_class = 'UNL_Auth_'.$auth_type.'_ZendAuth';
+ $class_file = dirname(__FILE__).'/Auth/'.$auth_type.'/ZendAuth.php';
+ $container = self::discoverAndReturn($auth_class, $class_file, $options);
+ return $container;
+ }
+
+ /**
+ * This is a class used to discover and return a new class based given a class
+ * name and file.
+ *
+ * @param string $class name of the class to load UNL_Auth_CAS
+ * @param string $class_file ./Auth/CAS.php
+ *
+ * @return object
+ */
+ protected function discoverAndReturn($class, $class_file, $options = null)
+ {
+ if (!class_exists($class)) {
+ if (file_exists($class_file)) {
+ require_once $class_file;
+ } else {
+ throw new Exception('Cannot find authentication class that matches '.
+ $auth_type.' I tried '.$class_file);
+ }
+ }
+ if (method_exists($class, 'getInstance')) {
+ return call_user_func(array($class, 'getInstance'), $options);
+ } else {
+ return new $class($options);
+ }
+
+ }
+}
+
+
+?>
\ No newline at end of file
diff --git a/lib/php/UNL/Auth/CAS.php b/lib/php/UNL/Auth/CAS.php
new file mode 100644
index 0000000000000000000000000000000000000000..a73d4d1440d39413c6faf307cb084158cfb23428
--- /dev/null
+++ b/lib/php/UNL/Auth/CAS.php
@@ -0,0 +1,157 @@
+<?php
+/**
+ * This is a CAS central authentication.
+ *
+ * DO NOT MODIFY THIS FILE.
+ * This file remains part of the UNL Login public API and is subject to change.
+ * If you require features built into this class, please contact us by email at
+ * <accounts@answers4families.org>.
+ *
+ * based on the Answers4Families [http://www.answers4families.org/] Account Services
+ * LDAP-CAS API.
+ *
+ *
+ * PHP version 5
+ *
+ * @category Authentication
+ * @package UNL_Auth
+ * @author Brett Bieber <brett.bieber@gmail.com>
+ * @author Ryan Lim <rlim@ccfl.unl.edu>
+ * @copyright 2008 Regents of the University of Nebraska
+ * @license http://www1.unl.edu/wdn/wiki/Software_License BSD License
+ * @link http://pear.unl.edu/package/UNL_Auth
+ */
+
+require_once 'CAS.php';
+
+
+/**
+ * UNL_Auth_CAS
+ *
+ * This is the CAS UserAccount class.
+ * This class takes care of user authentication using CAS and obtains the user
+ * account information via LDAP.
+ *
+ * This class does not handle changes to the user account information. All account
+ * information changes are handled by http://login.unl.edu/
+ *
+ */
+class UNL_Auth_CAS extends UNL_Auth
+{
+
+ /**
+ * Boolean flag to if the user is authenticated or not.
+ *
+ * @var bool
+ */
+ protected $isAuth = false;
+
+ /**
+ * $uid is the LDAP uid value of the authenticated user.
+ *
+ * @var string
+ */
+ protected $uid;
+
+ /**
+ * Options for the CAS server
+ *
+ * @var array
+ */
+ protected $cas_options = array('host' => 'login.unl.edu',
+ 'port' => 443,
+ 'path' => 'cas');
+
+ /**
+ * The class constructor used to initialize the phpCAS class settings.
+ */
+ private function __construct(array $options = null)
+ {
+ if (session_id() != '') {
+ $start_session = false;
+ } else {
+ $start_session = true;
+ }
+ phpCAS::setDebug(false);
+ phpCAS::client(CAS_VERSION_2_0,
+ $this->cas_options['host'], $this->cas_options['port'], $this->cas_options['path'],
+ $start_session);
+ phpCAS::setNoCasServerValidation();
+ phpCAS::setCacheTimesForAuthRecheck(-1);
+
+ $this->isAuth = phpCAS::checkAuthentication();
+ }
+
+ /**
+ * get a singleton instance of this class
+ *
+ * @return UNL_Auth_CAS
+ */
+ public static function getInstance()
+ {
+ if (null === self::$_instance) {
+ self::$_instance = new self();
+ }
+
+ return self::$_instance;
+ }
+
+ /**
+ * Log in the user.
+ */
+ function login()
+ {
+ phpCAS::forceAuthentication();
+ $this->isAuth = true;
+ $this->uid = phpCAS::getUser();
+ }
+
+ /**
+ * Log out the user.
+ */
+ function logout()
+ {
+ $this->isAuth = false;
+ phpCAS::forceAuthentication();
+ if (!empty($_SERVER['HTTP_REFERER'])) {
+ phpCAS::logoutWithUrl($_SERVER['HTTP_REFERER']);
+ } else {
+ phpCAS::logout();
+ }
+ }
+
+ /**
+ * Checks to see if the user is logged in.
+ *
+ * @return bool true if logged in, false otherwise.
+ */
+ function isLoggedIn()
+ {
+ return $this->isAuth;
+ }
+
+ /**
+ * Get the LDAP-uid.
+ *
+ * @return string | bool The LDAP uid of the logged in user.
+ */
+ function getUser()
+ {
+ if ($this->isAuth) {
+ return phpCAS::getUser();
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Stores the LDAP-uid internally in this instance of the class.
+ *
+ * @return string The LDAP uid of the logged in user. If the user is not logged in, return false.
+ */
+ function getUid()
+ {
+ $this->uid = $this->getUser();
+ return $this->uid;
+ }
+}
diff --git a/lib/php/UNL/Auth/CAS/PEARAuth.php b/lib/php/UNL/Auth/CAS/PEARAuth.php
new file mode 100644
index 0000000000000000000000000000000000000000..c2f441bf5b64d9670e95fd6f8160b47519df4079
--- /dev/null
+++ b/lib/php/UNL/Auth/CAS/PEARAuth.php
@@ -0,0 +1,65 @@
+<?php
+/**
+ * PEAR Auth compatible container for CAS
+ *
+ * PHP version 5
+ *
+ * @category Default
+ * @package UNL_Auth
+ * @author Brett Bieber <brett.bieber@gmail.com>
+ * @copyright 2008 Regents of the University of Nebraska
+ * @license http://www1.unl.edu/wdn/wiki/Software_License BSD License
+ * @link http://pear.unl.edu/package/UNL_Auth
+ */
+
+include_once 'Auth/Container.php';
+require_once 'UNL/Auth/CAS.php';
+
+class UNL_Auth_CAS_PEARAuth extends Auth_Container
+{
+ protected $cas;
+
+ public function __construct($options)
+ {
+ $this->cas = UNL_Auth_CAS::getInstance();
+ }
+
+ public function getPEARAuth($options = null, $loginFunction = null, $showLogin = true)
+ {
+ if (!isset($loginFunction)) {
+ $loginFunction = array('UNL_Auth_CAS_PEARAuth', 'login');
+ }
+ $auth = new Auth($this, $options, $loginFunction, $showLogin);
+ if ($this->checkAuth()) {
+ $auth->setAuth($this->getUsername());
+ }
+ $auth->setLogoutCallback(array('UNL_Auth_CAS_PEARAuth','logout'));
+ return $auth;
+ }
+
+ public function login()
+ {
+ UNL_Auth_CAS::getInstance()->login();
+ }
+
+ public function logout()
+ {
+ return UNL_Auth_CAS::getInstance()->logout();
+ }
+
+ public function getAuth()
+ {
+ return UNL_Auth_CAS::getInstance()->isLoggedIn();
+ }
+
+ public function checkAuth()
+ {
+ return UNL_Auth_CAS::getInstance()->isLoggedIn();
+ }
+
+ public function getUsername()
+ {
+ return UNL_Auth_CAS::getInstance()->getUser();
+ }
+
+}
diff --git a/lib/php/UNL/Auth/SimpleCAS.php b/lib/php/UNL/Auth/SimpleCAS.php
new file mode 100644
index 0000000000000000000000000000000000000000..6f2cd0cfb1be2d0c7281e752d9723b671ab2c268
--- /dev/null
+++ b/lib/php/UNL/Auth/SimpleCAS.php
@@ -0,0 +1,107 @@
+<?php
+/**
+ * This is a CAS central authentication.
+ *
+ * PHP version 5
+ *
+ * @category Authentication
+ * @package UNL_Auth
+ * @author Brett Bieber <brett.bieber@gmail.com>
+ * @copyright 2008 Regents of the University of Nebraska
+ * @license http://www1.unl.edu/wdn/wiki/Software_License BSD License
+ * @link http://pear.unl.edu/package/UNL_Auth
+ */
+
+require_once 'SimpleCAS/Autoload.php';
+require_once 'HTTP/Request2.php';
+
+/**
+ * UNL_Auth_SimpleCAS
+ *
+ * This is the CAS UserAccount class.
+ * This class takes care of user authentication using CAS and obtains the user
+ * account information via LDAP.
+ *
+ * This class does not handle changes to the user account information. All account
+ * information changes are handled by http://login.unl.edu/
+ *
+ */
+class UNL_Auth_SimpleCAS extends UNL_Auth
+{
+ /**
+ * Boolean flag to if the user is authenticated or not.
+ *
+ * @var bool
+ */
+ protected $isAuth = false;
+
+ /**
+ * $uid is the LDAP uid value of the authenticated user.
+ *
+ * @var string
+ */
+ protected $uid;
+
+ /**
+ * Options for the CAS server
+ *
+ * @var array
+ */
+ protected $options = array('hostname' => 'login.unl.edu',
+ 'port' => 443,
+ 'uri' => 'cas');
+
+ protected $client;
+
+ /**
+ * The class constructor used to initialize the SimpleCAS class settings.
+ */
+ private function __construct(array $options = array())
+ {
+ $options = array_merge($this->options, $options);
+ $protocol = new SimpleCAS_Protocol_Version2($this->options);
+
+ $protocol->getRequest()->setConfig('ssl_verify_peer', false);
+
+ $this->client = SimpleCAS::client($protocol);
+ if ($this->client->isAuthenticated()) {
+ $this->isAuth = true;
+ $this->uid = $this->client->getUsername();
+ }
+ }
+
+ /**
+ * get a singleton instance of this class
+ *
+ * @return UNL_Auth_SimpleCAS
+ */
+ public static function getInstance()
+ {
+ if (null === self::$_instance) {
+ self::$_instance = new self();
+ }
+
+ return self::$_instance;
+ }
+
+ function isLoggedIn()
+ {
+ return $this->isAuth;
+ }
+
+ function getUser()
+ {
+ return $this->client->getUsername();
+ }
+
+ function login()
+ {
+ return $this->client->forceAuthentication();
+ }
+
+ function logout()
+ {
+ return $this->client->logout();
+ }
+}
+?>
\ No newline at end of file
diff --git a/lib/php/UNL/Auth/SimpleCAS/ZendAuth.php b/lib/php/UNL/Auth/SimpleCAS/ZendAuth.php
new file mode 100644
index 0000000000000000000000000000000000000000..8a759b39286f1178b7da0078874314594b9b4b5b
--- /dev/null
+++ b/lib/php/UNL/Auth/SimpleCAS/ZendAuth.php
@@ -0,0 +1,78 @@
+<?php
+/**
+ * This is a Zend_Auth adapter library for CAS.
+ * It uses SimpleCAS.
+ *
+ * <code>
+ * public function casAction()
+ * {
+ * $auth = Zend_Auth::getInstance();
+ * $authAdapter = UNL_Auth::factory('SimpleCAS', Zend_Registry::get('config')->auth->cas);
+ *
+ * # User has not been identified, and there's a ticket in the URL
+ * if (!$auth->hasIdentity() && isset($_GET['ticket'])) {
+ * $authAdapter->setTicket($_GET['ticket']);
+ * $result = $auth->authenticate($authAdapter);
+ *
+ * if ($result->isValid()) {
+ * Zend_Session::regenerateId();
+ * }
+ * }
+ *
+ * # No ticket or ticket was invalid. Redirect to CAS.
+ * if (!$auth->hasIdentity()) {
+ * $this->_redirect($authAdapter->getLoginURL());
+ * }
+ * }
+ * </code>
+ */
+
+
+/**
+ * @see Zend_Auth_Adapter_Interface
+ */
+require_once 'Zend/Auth/Adapter/Interface.php';
+
+require_once 'UNL/Auth/SimpleCAS.php';
+
+class UNL_Auth_SimpleCAS_ZendAuth implements Zend_Auth_Adapter_Interface
+{
+ /**
+ * CAS client
+ *
+ * @var UNL_Auth_SimpleCAS
+ */
+ protected $_simplecas;
+
+ /**
+ * Constructor
+ *
+ * @return void
+ */
+ public function __construct()
+ {
+ $this->_simplecas = UNL_Auth::factory('SimpleCAS');
+ }
+
+ /**
+ * Authenticates the user
+ *
+ * @return Zend_Auth_Result
+ */
+ public function authenticate()
+ {
+ $this->_simplecas->login();
+ if ($this->_simplecas->isLoggedIn()) {
+ return new Zend_Auth_Result(
+ Zend_Auth_Result::SUCCESS,
+ $this->_simplecas->getUser(),
+ array("Authentication successful"));
+ } else {
+ return new Zend_Auth_Result(
+ Zend_Auth_Result::FAILURE,
+ null,
+ array("Authentication failed"));
+ }
+ }
+
+}
diff --git a/src/UNL/UCARE/Confirmation.php b/src/UNL/UCARE/Confirmation.php
new file mode 100644
index 0000000000000000000000000000000000000000..864639e10a4b7ce3b658f3f32bc6af02f14bd33e
--- /dev/null
+++ b/src/UNL/UCARE/Confirmation.php
@@ -0,0 +1,6 @@
+<?php
+class UNL_UCARE_Confirmation
+{
+ public $message;
+}
+?>
\ No newline at end of file
diff --git a/src/UNL/UCARE/Controller.php b/src/UNL/UCARE/Controller.php
index 08c2ae2eb8100e86418a8cecdbf4797aa7a18d2f..5549610ded7ba8adf819f10ce7f402cc3f67a3a9 100644
--- a/src/UNL/UCARE/Controller.php
+++ b/src/UNL/UCARE/Controller.php
@@ -3,16 +3,32 @@ class UNL_UCARE_Controller
{
public $options = array('view' => 'year1');
- protected $view_map = array('year1'=>'UNL_UCARE_Year1Application');
+ protected $view_map = array('year1' => 'UNL_UCARE_Year1Application',
+ 'year2' => 'UNL_UCARE_Year2Application',
+ 'thanks' => 'UNL_UCARE_Confirmation');
public $actionable = array();
function __construct($options)
{
- $this->options += $options;
+ $options += $this->options;
+ $this->options = $options;
+ if (!empty($_POST)) {
+ $this->handlePost();
+ }
$this->run();
}
+ function handlePost()
+ {
+ switch($_POST['type']) {
+ case 'year1':
+ case 'year2':
+ // save the app
+ header('Location: ?view=thanks');
+ }
+ }
+
function run()
{
if (isset($this->view_map[$this->options['view']])) {
diff --git a/www/templates/Confirmation.tpl.php b/www/templates/Confirmation.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..bcfa2d42296732a2f6d0946d885d96c8da2cac42
--- /dev/null
+++ b/www/templates/Confirmation.tpl.php
@@ -0,0 +1,4 @@
+<h3>Thank you for submitting your UCARE application.</h3>
+
+<p>Once the faculty member has approved your application it will be reviewed.</p>
+<p>If you have any questions, contact us.</p>
\ No newline at end of file
diff --git a/www/templates/Controller.tpl.php b/www/templates/Controller.tpl.php
index 0f6b11a5af74647a51b9e854f81d412077b78969..022ddb413505436b44e1c16ea71e2025943b3ce6 100644
--- a/www/templates/Controller.tpl.php
+++ b/www/templates/Controller.tpl.php
@@ -4,5 +4,4 @@ $p = UNL_Templates::factory('Secure');
$p->doctitle = '<title>UNL | UCARE Application</title>';
$p->titlegraphic = '<h1>UCARE Application</h1>';
$p->maincontentarea = UNL_UCARE_OutputController::display($this->actionable, true);
-
echo $p;
diff --git a/www/templates/Year1Application.tpl.php b/www/templates/Year1Application.tpl.php
index b5fa873bc2fd74a18562498d0795416186197ad6..ed94605d6207d9cd255f6299650326908e198a5c 100644
--- a/www/templates/Year1Application.tpl.php
+++ b/www/templates/Year1Application.tpl.php
@@ -2,6 +2,7 @@
WDN.loadCSS('http://www.unl.edu/ucomm/templatedependents/templatecss/components/forms.css');
</script>
<form action="?" method="post">
+ <input type="hidden" name="type" value="year1" />
<fieldset>
<legend>Sample Form Content</legend>
<ol>