getProxiedService() public method

Answer a proxy-authenticated service handler.
public getProxiedService ( string $type ) : CAS_ProxiedService
$type string The service type. One of: PHPCAS_PROXIED_SERVICE_HTTP_GET, PHPCAS_PROXIED_SERVICE_HTTP_POST, PHPCAS_PROXIED_SERVICE_IMAP
return CAS_ProxiedService
コード例 #1
0
ファイル: ServiceMailTest.php プロジェクト: tillk/vufind
 /**
  * Verify that a CAS_ProxyTicketException is thrown if we try to access a service
  * that results in a proxy-ticket failure.
  *
  * @return void
  *
  * @expectedException CAS_ProxyTicketException
  */
 public function testPtException()
 {
     $service = $this->object->getProxiedService(PHPCAS_PROXIED_SERVICE_IMAP);
     $service->setServiceUrl('imap://mail.example.edu/path/that/doesnt/exist');
     $service->setMailbox('mailbox_name');
     $service->setOptions(OP_READONLY);
     $stream = $service->open();
 }
コード例 #2
0
ファイル: ServiceWebTest.php プロジェクト: dwoodard/phpcas
 /**
  * Direct usage of the Proxied POST service.
  *
  * @return void
  */
 public function testHttpPost()
 {
     $service = $this->object->getProxiedService(PHPCAS_PROXIED_SERVICE_HTTP_POST);
     $service->setUrl('http://www.service.com/post_webservice');
     $service->setBody('<request><method>doSomething</method><param type="string">with this</param></request>');
     $service->setContentType('text/xml');
     $service->send();
     $this->assertEquals(200, $service->getResponseStatusCode());
     $this->assertEquals("<result><string>Yay, it worked.</string></result>", $service->getResponseBody());
 }
コード例 #3
0
ファイル: CAS.php プロジェクト: DCUnit711/Demeter
 /**
  * Answer a proxy-authenticated service handler.
  *
  * @param string $type The service type. One of
  * PHPCAS_PROXIED_SERVICE_HTTP_GET; PHPCAS_PROXIED_SERVICE_HTTP_POST;
  * PHPCAS_PROXIED_SERVICE_IMAP
  *
  * @return CAS_ProxiedService
  * @throws InvalidArgumentException If the service type is unknown.
  */
 public static function getProxiedService($type)
 {
     phpCAS::traceBegin();
     phpCAS::_validateProxyExists();
     try {
         $res = self::$_PHPCAS_CLIENT->getProxiedService($type);
     } catch (Exception $e) {
         phpCAS::error(get_class($e) . ': ' . $e->getMessage());
     }
     phpCAS::traceEnd();
     return $res;
 }