public function execute() { Sso_PhpCas::logout(); echo "SUCCESS!"; }
/** * @brief 全局初始化接口 * * @return success-true failed-false * @retval boolean * @see getCasInit() * @note 这个函数修改了session的存储文件路径为/odp/data/phpcas,并关闭了phpCAS第三方库本身的日志 * @note 在一个CGI中phpCAS client对象只能被初始化一次,因此设置$isCasClientInit属性用来控制 * @author chenyijie * @date 2012/09/28 22:28:43 **/ private static function init() { if (self::$isCasClientInit) { return true; } if (!self::getCasInit()) { Bd_Log::warning('UUAP CAS protocol init failed'); return false; } $link = self::$arrConf['Server'][0]['Hostname']; $port = self::$arrConf['DefaultPort']; phpCAS::setDebug(''); phpCAS::client(CAS_VERSION_2_0, $link, intval($port), '', false); // 自己管理session,最后参数为false by yuliang phpCAS::setNoCasServerValidation(); phpCAS::handleLogoutRequests(false); self::$isCasClientInit = true; return true; }
<?php /** * @name index * @desc 入口文件 * @author 符广森(fuguangsen@baidu.com) */ define('CAS_CALLBACK_SERVER', 'mis.navi.baidu.com'); $objApplication = Bd_Init::init(); Session_Factory::init(); if ($_GET['logout']) { Sso_PhpCas::logout(); } else { //忽略登录验证 if ($_GET["ignoreLogin"] == 1 || $_POST["ignoreLogin"] == 1) { $username = ""; } else { $username = Sso_PhpCas::login(); } define('CURRENT_USER', $username); } $objResponse = $objApplication->bootstrap()->run();