From ca9fdf801ed890d8338c525a390b2a2a5d261dae Mon Sep 17 00:00:00 2001 From: Brett Bieber <brett.bieber@gmail.com> Date: Sun, 29 Nov 2009 14:04:00 +0000 Subject: [PATCH] Add the UNL_Auth library, add confirmation template, set up post handling. --- lib/.pear2registry | Bin 275456 -> 286720 bytes .../channel-simplecas.googlecode.com##svn.xml | 15 ++ .../channels/channelalias-simplecas.txt | 1 + .../pear.unl.edu/UNL_Auth/0.3.2-info.xml | 163 ++++++++++++++++++ .../docs/examples/CASPEARAuth_example.php | 26 +++ .../UNL_Auth/docs/examples/CAS_example.php | 22 +++ .../docs/examples/SimpleCAS_example.php | 22 +++ .../docs/examples/Zend_SimpleCAS_example.php | 26 +++ lib/php/UNL/Auth.php | 118 +++++++++++++ lib/php/UNL/Auth/CAS.php | 157 +++++++++++++++++ lib/php/UNL/Auth/CAS/PEARAuth.php | 65 +++++++ lib/php/UNL/Auth/SimpleCAS.php | 107 ++++++++++++ lib/php/UNL/Auth/SimpleCAS/ZendAuth.php | 78 +++++++++ src/UNL/UCARE/Confirmation.php | 6 + src/UNL/UCARE/Controller.php | 20 ++- www/templates/Confirmation.tpl.php | 4 + www/templates/Controller.tpl.php | 1 - www/templates/Year1Application.tpl.php | 1 + 18 files changed, 829 insertions(+), 3 deletions(-) create mode 100644 lib/.xmlregistry/channels/channel-simplecas.googlecode.com##svn.xml create mode 100644 lib/.xmlregistry/channels/channelalias-simplecas.txt create mode 100644 lib/.xmlregistry/packages/pear.unl.edu/UNL_Auth/0.3.2-info.xml create mode 100644 lib/docs/UNL_Auth/docs/examples/CASPEARAuth_example.php create mode 100644 lib/docs/UNL_Auth/docs/examples/CAS_example.php create mode 100644 lib/docs/UNL_Auth/docs/examples/SimpleCAS_example.php create mode 100644 lib/docs/UNL_Auth/docs/examples/Zend_SimpleCAS_example.php create mode 100644 lib/php/UNL/Auth.php create mode 100644 lib/php/UNL/Auth/CAS.php create mode 100644 lib/php/UNL/Auth/CAS/PEARAuth.php create mode 100644 lib/php/UNL/Auth/SimpleCAS.php create mode 100644 lib/php/UNL/Auth/SimpleCAS/ZendAuth.php create mode 100644 src/UNL/UCARE/Confirmation.php create mode 100644 www/templates/Confirmation.tpl.php diff --git a/lib/.pear2registry b/lib/.pear2registry index f730b57a291602618899cfcdfef23bcfe028b6d2..4b735cd904fc772daa7efb34c00e940528978569 100644 GIT binary patch delta 7662 zcmZp8A<%F@aDp@=-$t1i>{8rJrx}<xGs`d+GGAbR#ypYfG}BXNW@ZcK@XdleYnkLF zS!7iiOY?H#6H7}n3Q`k`^h)z`^ioqwxn)^YRT(F5SR}ETiJM83S%$%HGP{Bnqu*o$ z1sOh7R#{bLxW37bisI}tnyjj-%3vLneHFPk&s9ig=3-?2#lXP8D8&40GoK0zBR8XX zW|BSw10z?H(q>uJyG(2h42*(}R+}_fc!b!QRT!8bGw)|!z+A_i#O%ndvRROak6Bil zomEzqpC6ke_4Ow^njhw3XVzh0e!_f!S!Xkkg&ebzG)M#7b;!QbXP0MHRpke}a&wyX zEDIG@ko%Z_gGe#v-%Q_`wlNhmsW4t;>|}IfWMMeV(9IA$S&&EH!i<lXQC3w{l~I_1 zftP`S0h@aqVS!kXQJ|NXTEbwcXRx`uq<~qHfq_w!kBfnUL4YBffytQh4O0cfeTEGT z*^~Jy!s}f)8D&-FU3nQ8u^JnknOl&P>g*U?3}z%J7VD+w=cnhSCg-Q5>Lusr>KB*g z3Fv_g5mv=zh_hoba!By&gOrPcm8%lt7rxE>m0#7QxS2W`m>)17VP42w$sEjV%*@C1 zhUqNRN~X@uf;`zw3Ub`6vZ~@(y<w_nsAsf!<)Uat>LknMOuUph$578i&v^67ZPaqk zZYEw44n}bX<~hs;OqZEzn3Ng!GL|ulPZs3)?-<L$;VLgLFRiYKFAm{yn2gEuPfD>E z8yJ~yE<4%BB*MX*$H2Uac@Oh@=7r36na?oyGv{p<<OyR|RA6>xglor=PB<p_pDz{R zU|!3>e2)1$^IPU8%r}^KGp}Vnwpoy8Dl;E1vphmS$L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$%zZ`KI^XWENy` zVQplD*p!gQEHV8<Dzh_-8*3vgT#RG-e03H9Hb!|L)<!{u==QZ~%)yKh8!jlbNKQYH z!OYIaaL=2yksqRJf+9=FwhU&L0tpVrH6UkQVw%qs&$x#16Vp9rb>=GOU7H1Y+8KG7 ztQh>gSk+Y%85kHgPFECWF`3@i#LP4O!%b#iHC1O;b=6={R<;922~%laPJBsfZb43B zNosLHYGM%s1H(#C%&1SdIm{$F`HZgP_6N6^Ra{wEnZg*h^C_@|GEP?D`8j<fC^z?& xG4pR<uEY|{$;QZ(!oZZWS&%1+X?uzu%K}C=M&?xv%&RsF@+@GUzRH*-3;=5<Lk$1` 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 0000000..8de923b --- /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 0000000..fdae489 --- /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 0000000..f26b986 --- /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 0000000..8b24427 --- /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 0000000..42acfc6 --- /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 0000000..d514e53 --- /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 0000000..adac078 --- /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 0000000..a7ac0f3 --- /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 0000000..a73d4d1 --- /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 0000000..c2f441b --- /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 0000000..6f2cd0c --- /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 0000000..8a759b3 --- /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 0000000..864639e --- /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 08c2ae2..5549610 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 0000000..bcfa2d4 --- /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 0f6b11a..022ddb4 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 b5fa873..ed94605 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> -- GitLab