* Copyright 2011, Roland Mas * * This file is part of FusionForge * * This plugin, like FusionForge, is free software; you can redistribute it * and/or modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * FusionForge is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with FusionForge; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US */ require_once $GLOBALS['gfcommon'].'include/User.class.php'; require_once 'CAS.php'; class AuthCASPlugin extends ForgeAuthPlugin { protected $saved_login; protected $saved_password; protected $saved_user; protected $saved_data; function AuthCASPlugin () { global $gfconfig; $this->ForgeAuthPlugin() ; $this->name = "authcas"; $this->text = "CAS authentication"; $this->_addHook('display_auth_form'); $this->_addHook("check_auth_session"); $this->_addHook("fetch_authenticated_user"); $this->_addHook("close_auth_session"); $this->saved_login = ''; $this->saved_user = NULL; $this->cookie_name = 'forge_session_cas'; $this->declareConfigVars(); } private static $init = false; function initCAS() { if (self::$init) { return; } phpCAS::client(forge_get_config('cas_version', $this->name), forge_get_config('cas_server', $this->name), intval(forge_get_config('cas_port', $this->name)), ''); self::$init = true; } function displayAuthForm($params) { if (!$this->isRequired() && !$this->isSufficient()) { return true; } $return_to = $params['return_to']; $this->initCAS(); echo '