Example #1
0
 /**
  * Initialize a proxied-service handler with the proxy-ticket it should use.
  *
  * @param CAS_ProxiedService $proxiedService service handler
  *
  * @return void
  *
  * @throws CAS_ProxyTicketException If there is a proxy-ticket failure.
  *		The code of the Exception will be one of:
  *			PHPCAS_SERVICE_PT_NO_SERVER_RESPONSE
  *			PHPCAS_SERVICE_PT_BAD_SERVER_RESPONSE
  *			PHPCAS_SERVICE_PT_FAILURE
  * @throws CAS_ProxiedService_Exception If there is a failure getting the
  * url from the proxied service.
  */
 public function initializeProxiedService(CAS_ProxiedService $proxiedService)
 {
     $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);
 }
Example #2
0
 /**
  * Initialize a proxied-service handler with the proxy-ticket it should use.
  *
  * @param CAS_ProxiedService $proxiedService service handler
  *
  * @return void
  *
  * @throws CAS_ProxyTicketException If there is a proxy-ticket failure.
  *		The code of the Exception will be one of:
  *			PHPCAS_SERVICE_PT_NO_SERVER_RESPONSE
  *			PHPCAS_SERVICE_PT_BAD_SERVER_RESPONSE
  *			PHPCAS_SERVICE_PT_FAILURE
  * @throws CAS_ProxiedService_Exception If there is a failure getting the
  * url from the proxied service.
  */
 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);
 }