protected function initializeCASClient() { if (!phpCAS::isInitialized()) { // Set debug mode phpCAS::setDebug(false); //Initialize phpCAS phpCAS::client(CAS_VERSION_2_0, Configure::read('user_config.cas.hostname'), Configure::read('user_config.cas.port'), Configure::read('user_config.cas.uri'), true); phpCAS::setFixedServiceURL($this->loginRedirectURL()); // No SSL validation for the CAS server phpCAS::setNoCasServerValidation(); } return true; }
/** * Set adapater state from options array * * @param array $options * @return Zend_Auth_Adapter_Cas */ public function setOptions(array $options) { $forbidden = array('Options', 'Config'); foreach ($options as $key => $value) { $normalized = ucfirst($key); if (in_array($normalized, $forbidden)) { continue; } $method = 'set' . $normalized; if (method_exists($this, $method)) { $this->{$method}($value); } } if (empty($this->getApiKey())) { throw new Exception("API Key not found"); } if (empty($this->getSecret())) { throw new Exception("API Secret not found"); } if (!phpCAS::isInitialized()) { phpCAS::client(CAS_VERSION_2_0, $this->getHostname(), $this->getPort(), $this->getPath()); phpCAS::setExtraCurlOption(CURLOPT_SSL_VERIFYHOST, false); phpCAS::setExtraCurlOption(CURLOPT_SSL_VERIFYPEER, false); } // Set the URL $url = $this->getUrl(); if (empty($url)) { $this->setUrl(); } // Set the service URL $service = $this->getService(); if (empty($service)) { $this->setService(); } // Set the login URL $loginUrl = $this->getLoginUrl(); if (empty($loginUrl)) { $this->setLoginUrl(); } // Set the logout URL $logoutUrl = $this->getLogoutUrl(); if (empty($logoutUrl)) { $this->setLogoutUrl(); } $this->configureCasValidation($options); return $this; }
/** * Initializes the PHP CAS client * * @return void **/ private function initialize() { if (!phpCAS::isInitialized()) { phpCAS::client(CAS_VERSION_2_0, 'www.purdue.edu', 443, '/apps/account/cas', false); } phpCAS::setNoCasServerValidation(); }