CAS_Client::setPGTStorageFile PHP Method

setPGTStorageFile() public method

This method is used to tell phpCAS to store the response of the CAS server to PGT requests onto the filesystem.
public setPGTStorageFile ( string $path = '' ) : void
$path string the path where the PGT's should be stored
return void
    public function setPGTStorageFile($path = '')
    {
        // Sequence validation
        $this->ensureIsProxy();
        // Argument validation
        if (gettype($path) != 'string') {
            throw new CAS_TypeMismatchException($path, '$path', 'string');
        }
        // create the storage object
        $this->setPGTStorage(new CAS_PGTStorage_File($this, $path));
    }

Usage Example

 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;
 }
All Usage Examples Of CAS_Client::setPGTStorageFile
CAS_Client