CAS_Client::initializeProxiedService PHP Method

initializeProxiedService() public method

Initialize a proxied-service handler with the proxy-ticket it should use.
public initializeProxiedService ( CAS_ProxiedService $proxiedService ) : void
$proxiedService CAS_ProxiedService service handler
return void
    public function initializeProxiedService(CAS_ProxiedService $proxiedService)
    {
        // Sequence validation
        $this->ensureIsProxy();
        $this->ensureAuthenticationCallSuccessful();
        $url = $proxiedService->getServiceUrl();
        if (!is_string($url)) {
            throw new CAS_ProxiedService_Exception("Proxied Service " . get_class($proxiedService) . "->getServiceUrl() should have returned a string, returned a " . gettype($url) . " instead.");
        }
        $pt = $this->retrievePT($url, $err_code, $err_msg);
        if (!$pt) {
            throw new CAS_ProxyTicketException($err_msg, $err_code);
        }
        $proxiedService->setProxyTicket($pt);
    }

Usage Example

示例#1
0
 /**
  * Fetch our proxy ticket.
  *
  * Descendent classes should call this method once their service URL is available
  * to initialize their proxy ticket.
  *
  * @return void
  * @throws CAS_OutOfSequenceException If called after a proxy ticket has
  * already been initialized.
  */
 protected function initializeProxyTicket()
 {
     if (!empty($this->_proxyTicket)) {
         throw new CAS_OutOfSequenceException('Already initialized, cannot initialize again.');
     }
     // Allow usage of a particular CAS_Client for unit testing.
     if (empty($this->_casClient)) {
         phpCAS::initializeProxiedService($this);
     } else {
         $this->_casClient->initializeProxiedService($this);
     }
 }
All Usage Examples Of CAS_Client::initializeProxiedService
CAS_Client