setPGTStorage() public method

This method can be used to set a custom PGT storage object.
public setPGTStorage ( CAS_PGTStorage_AbstractStorage $storage ) : void
$storage CAS_PGTStorage_AbstractStorage a PGT storage object that inherits from the CAS_PGTStorage_AbstractStorage class
return void
 private function initializeCAS()
 {
     $casClient = new \CAS_Client(CAS_VERSION_2_0, true, Config::get('cas.hostname'), Config::get('cas.port'), Config::get('cas.context'));
     $casClient->setNoCasServerValidation();
     if (true === Config::get('pgtservice.enabled', false)) {
         $casClient->setCallbackURL(Config::get('pgtservice.callback'));
         $casClient->setPGTStorage(new ProxyTicketServiceStorage($casClient));
     } else {
         if (false !== Config::get('redis.hostname', false)) {
             $casClient->setCallbackURL($this->url->getURL() . '/callback.php');
             $redis = new \Redis();
             $redis->connect(Config::get('redis.hostname'), Config::get('redis.port', 6379), 2, null, 100);
             $redis->setOption(\Redis::OPT_SERIALIZER, \Redis::SERIALIZER_PHP);
             $redis->setOption(\Redis::OPT_PREFIX, Config::get('application.project_name') . ':PHPCAS_TICKET_STORAGE:');
             $redis->select((int) Config::get('redis.hostname', 2));
             $casClient->setPGTStorage(new RedisTicketStorage($casClient, $redis));
         } else {
             $casClient->setCallbackURL($this->url->getURL() . '/callback.php');
             $casClient->setPGTStorageFile(session_save_path());
             // Handle logout requests but do not validate the server
             $casClient->handleLogoutRequests(false);
         }
     }
     // Accept all proxy chains
     $casClient->getAllowedProxyChains()->allowProxyChain(new \CAS_ProxyChain_Any());
     return $casClient;
 }
Ejemplo n.º 2
0
 /**
  * This method can be used to set a custom PGT storage object.
  *
  * @param CAS_PGTStorage $storage a PGT storage object that inherits from the
  * CAS_PGTStorage class
  *
  * @return void
  */
 public static function setPGTStorage($storage)
 {
     phpCAS::traceBegin();
     phpCAS::_validateProxyExists();
     try {
         self::$_PHPCAS_CLIENT->setPGTStorage($storage);
     } catch (Exception $e) {
         phpCAS::error(get_class($e) . ': ' . $e->getMessage());
     }
     phpCAS::traceEnd();
 }