ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
+ Collaboration diagram for Proxy other services:

Functions

 CAS_Client::getProxiedService ($type)
 Answer a proxy-authenticated service handler. More...
 
 CAS_Client::initializeProxiedService (CAS_ProxiedService $proxiedService)
 Initialize a proxied-service handler with the proxy-ticket it should use. More...
 
 CAS_Client::serviceWeb ($url, &$err_code, &$output)
 This method is used to access an HTTP[S] service. More...
 
 CAS_Client::serviceMail ($url, $serviceUrl, $flags, &$err_code, &$err_msg, &$pt)
 This method is used to access an IMAP/POP3/NNTP service. More...
 

Detailed Description

Function Documentation

◆ getProxiedService()

CAS_Client::getProxiedService (   $type)

Answer a proxy-authenticated service handler.

Parameters
string$typeThe service type. One of: PHPCAS_PROXIED_SERVICE_HTTP_GET, PHPCAS_PROXIED_SERVICE_HTTP_POST, PHPCAS_PROXIED_SERVICE_IMAP
Returns
CAS_ProxiedService
Exceptions
InvalidArgumentExceptionIf the service type is unknown.

Definition at line 2968 of file Client.php.

References CAS_Client\$_requestImplementation, $request, $type, CAS_Client\_getUser(), CAS_Client\ensureAuthenticationCallSuccessful(), CAS_Client\ensureIsProxy(), PHPCAS_PROXIED_SERVICE_HTTP_GET, PHPCAS_PROXIED_SERVICE_HTTP_POST, and PHPCAS_PROXIED_SERVICE_IMAP.

Referenced by CAS_Client\serviceMail(), and CAS_Client\serviceWeb().

2969  {
2970  // Sequence validation
2971  $this->ensureIsProxy();
2973 
2974  // Argument validation
2975  if (gettype($type) != 'string') {
2976  throw new CAS_TypeMismatchException($type, '$type', 'string');
2977  }
2978 
2979  switch ($type) {
2982  $requestClass = $this->_requestImplementation;
2983  $request = new $requestClass();
2984  if (count($this->_curl_options)) {
2985  $request->setCurlOptions($this->_curl_options);
2986  }
2987  $proxiedService = new $type($request, $this->_serviceCookieJar);
2988  if ($proxiedService instanceof CAS_ProxiedService_Testable) {
2989  $proxiedService->setCasClient($this);
2990  }
2991  return $proxiedService;
2993  $proxiedService = new CAS_ProxiedService_Imap($this->_getUser());
2994  if ($proxiedService instanceof CAS_ProxiedService_Testable) {
2995  $proxiedService->setCasClient($this);
2996  }
2997  return $proxiedService;
2998  default:
2999  throw new CAS_InvalidArgumentException(
3000  "Unknown proxied-service type, $type."
3001  );
3002  }
3003  }
const PHPCAS_PROXIED_SERVICE_IMAP
phpCAS::getProxiedService() type for IMAP
Definition: CAS.php:203
foreach($paths as $path) $request
Definition: asyncclient.php:32
$type
ensureIsProxy()
Ensure that this is actually a proxy object or fail with an exception.
Definition: Client.php:754
Provides access to a proxy-authenticated IMAP stream.
Definition: Imap.php:40
_getUser()
This method returns the CAS user's login name.
Definition: Client.php:1150
const PHPCAS_PROXIED_SERVICE_HTTP_POST
phpCAS::getProxiedService() type for HTTP POST
Definition: CAS.php:199
Exception that denotes invalid arguments were passed.
ensureAuthenticationCallSuccessful()
Ensure that authentication was checked.
Definition: Client.php:831
const PHPCAS_PROXIED_SERVICE_HTTP_GET
phpCAS::getProxiedService() type for HTTP GET
Definition: CAS.php:195
$_requestImplementation
The class to instantiate for making web requests in readUrl().
Definition: Client.php:610
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initializeProxiedService()

CAS_Client::initializeProxiedService ( CAS_ProxiedService  $proxiedService)

Initialize a proxied-service handler with the proxy-ticket it should use.

Parameters
CAS_ProxiedService$proxiedServiceservice handler
Returns
void
Exceptions
CAS_ProxyTicketExceptionIf 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
CAS_ProxiedService_ExceptionIf there is a failure getting the url from the proxied service.

Definition at line 3020 of file Client.php.

References $url, CAS_Client\ensureAuthenticationCallSuccessful(), CAS_Client\ensureIsProxy(), CAS_ProxiedService\getServiceUrl(), CAS_Client\retrievePT(), and CAS_ProxiedService\setProxyTicket().

3021  {
3022  // Sequence validation
3023  $this->ensureIsProxy();
3025 
3026  $url = $proxiedService->getServiceUrl();
3027  if (!is_string($url)) {
3028  throw new CAS_ProxiedService_Exception(
3029  "Proxied Service " . get_class($proxiedService)
3030  . "->getServiceUrl() should have returned a string, returned a "
3031  . gettype($url) . " instead."
3032  );
3033  }
3034  $pt = $this->retrievePT($url, $err_code, $err_msg);
3035  if (!$pt) {
3036  throw new CAS_ProxyTicketException($err_msg, $err_code);
3037  }
3038  $proxiedService->setProxyTicket($pt);
3039  }
retrievePT($target_service, &$err_code, &$err_msg)
This method is used to retrieve PT's from the CAS server thanks to a PGT.
Definition: Client.php:2742
An Exception for problems communicating with a proxied service.
Definition: Exception.php:40
ensureIsProxy()
Ensure that this is actually a proxy object or fail with an exception.
Definition: Client.php:754
setProxyTicket($proxyTicket)
Register a proxy ticket with the ProxiedService that it can use when making requests.
getServiceUrl()
Answer a service identifier (URL) for whom we should fetch a proxy ticket.
ensureAuthenticationCallSuccessful()
Ensure that authentication was checked.
Definition: Client.php:831
$url
An Exception for errors related to fetching or validating proxy tickets.
+ Here is the call graph for this function:

◆ serviceMail()

CAS_Client::serviceMail (   $url,
  $serviceUrl,
  $flags,
$err_code,
$err_msg,
$pt 
)

This method is used to access an IMAP/POP3/NNTP service.

Parameters
string$urla string giving the URL of the service, including the mailing box for IMAP URLs, as accepted by imap_open().
string$serviceUrla string giving for CAS retrieve Proxy ticket
string$flagsoptions given to imap_open().
int&$err_codean error code Possible values are PHPCAS_SERVICE_OK (on success), PHPCAS_SERVICE_PT_NO_SERVER_RESPONSE, PHPCAS_SERVICE_PT_BAD_SERVER_RESPONSE, PHPCAS_SERVICE_PT_FAILURE, PHPCAS_SERVICE_NOT_AVAILABLE.
string&$err_msgan error message on failure
string&$ptthe Proxy Ticket (PT) retrieved from the CAS server to access the URL on success, false on error).
Returns
object an IMAP stream on success, false otherwise (in this later case, $err_code gives the reason why it failed and $err_msg contains an error message).

Definition at line 3108 of file Client.php.

References $lang, GuzzleHttp\Psr7\$stream, $url, CAS_Client\ensureAuthenticationCallSuccessful(), CAS_Client\ensureIsProxy(), CAS_Client\getLangObj(), CAS_Client\getProxiedService(), PHPCAS_PROXIED_SERVICE_IMAP, PHPCAS_SERVICE_NOT_AVAILABLE, and PHPCAS_SERVICE_OK.

3109  {
3110  // Sequence validation
3111  $this->ensureIsProxy();
3113 
3114  // Argument validation
3115  if (gettype($url) != 'string') {
3116  throw new CAS_TypeMismatchException($url, '$url', 'string');
3117  }
3118  if (gettype($serviceUrl) != 'string') {
3119  throw new CAS_TypeMismatchException($serviceUrl, '$serviceUrl', 'string');
3120  }
3121  if (gettype($flags) != 'integer') {
3122  throw new CAS_TypeMismatchException($flags, '$flags', 'string');
3123  }
3124 
3125  try {
3127  $service->setServiceUrl($serviceUrl);
3128  $service->setMailbox($url);
3129  $service->setOptions($flags);
3130 
3131  $stream = $service->open();
3132  $err_code = PHPCAS_SERVICE_OK;
3133  $pt = $service->getImapProxyTicket();
3134  return $stream;
3135  } catch (CAS_ProxyTicketException $e) {
3136  $err_msg = $e->getMessage();
3137  $err_code = $e->getCode();
3138  $pt = false;
3139  return false;
3140  } catch (CAS_ProxiedService_Exception $e) {
3141  $lang = $this->getLangObj();
3142  $err_msg = sprintf(
3143  $lang->getServiceUnavailable(),
3144  $url,
3145  $e->getMessage()
3146  );
3147  $err_code = PHPCAS_SERVICE_NOT_AVAILABLE;
3148  $pt = false;
3149  return false;
3150  }
3151  }
getLangObj()
Create the language.
Definition: Client.php:226
const PHPCAS_PROXIED_SERVICE_IMAP
phpCAS::getProxiedService() type for IMAP
Definition: CAS.php:203
const PHPCAS_SERVICE_OK
phpCAS::service() error code on success
Definition: CAS.php:168
An Exception for problems communicating with a proxied service.
Definition: Exception.php:40
$stream
PHP stream implementation.
ensureIsProxy()
Ensure that this is actually a proxy object or fail with an exception.
Definition: Client.php:754
const PHPCAS_SERVICE_NOT_AVAILABLE
phpCAS::service() error code when the service was not available.
Definition: CAS.php:187
ensureAuthenticationCallSuccessful()
Ensure that authentication was checked.
Definition: Client.php:831
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Definition: langwiz.php:349
$url
An Exception for errors related to fetching or validating proxy tickets.
getProxiedService($type)
Answer a proxy-authenticated service handler.
Definition: Client.php:2968
+ Here is the call graph for this function:

◆ serviceWeb()

CAS_Client::serviceWeb (   $url,
$err_code,
$output 
)

This method is used to access an HTTP[S] service.

Parameters
string$urlthe service to access.
int&$err_codean error code Possible values are PHPCAS_SERVICE_OK (on success), PHPCAS_SERVICE_PT_NO_SERVER_RESPONSE, PHPCAS_SERVICE_PT_BAD_SERVER_RESPONSE, PHPCAS_SERVICE_PT_FAILURE, PHPCAS_SERVICE_NOT_AVAILABLE.
string&$outputthe output of the service (also used to give an error message on failure).
Returns
true on success, false otherwise (in this later case, $err_code gives the reason why it failed and $output contains an error message).

Definition at line 3055 of file Client.php.

References $lang, Sabre\VObject\$output, $url, CAS_Client\ensureAuthenticationCallSuccessful(), CAS_Client\ensureIsProxy(), CAS_Client\getLangObj(), CAS_Client\getProxiedService(), PHPCAS_PROXIED_SERVICE_HTTP_GET, PHPCAS_SERVICE_NOT_AVAILABLE, and PHPCAS_SERVICE_OK.

3056  {
3057  // Sequence validation
3058  $this->ensureIsProxy();
3060 
3061  // Argument validation
3062  if (gettype($url) != 'string') {
3063  throw new CAS_TypeMismatchException($url, '$url', 'string');
3064  }
3065 
3066  try {
3068  $service->setUrl($url);
3069  $service->send();
3070  $output = $service->getResponseBody();
3071  $err_code = PHPCAS_SERVICE_OK;
3072  return true;
3073  } catch (CAS_ProxyTicketException $e) {
3074  $err_code = $e->getCode();
3075  $output = $e->getMessage();
3076  return false;
3077  } catch (CAS_ProxiedService_Exception $e) {
3078  $lang = $this->getLangObj();
3079  $output = sprintf(
3080  $lang->getServiceUnavailable(),
3081  $url,
3082  $e->getMessage()
3083  );
3084  $err_code = PHPCAS_SERVICE_NOT_AVAILABLE;
3085  return false;
3086  }
3087  }
getLangObj()
Create the language.
Definition: Client.php:226
const PHPCAS_SERVICE_OK
phpCAS::service() error code on success
Definition: CAS.php:168
An Exception for problems communicating with a proxied service.
Definition: Exception.php:40
ensureIsProxy()
Ensure that this is actually a proxy object or fail with an exception.
Definition: Client.php:754
const PHPCAS_SERVICE_NOT_AVAILABLE
phpCAS::service() error code when the service was not available.
Definition: CAS.php:187
ensureAuthenticationCallSuccessful()
Ensure that authentication was checked.
Definition: Client.php:831
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Definition: langwiz.php:349
$url
const PHPCAS_PROXIED_SERVICE_HTTP_GET
phpCAS::getProxiedService() type for HTTP GET
Definition: CAS.php:195
An Exception for errors related to fetching or validating proxy tickets.
getProxiedService($type)
Answer a proxy-authenticated service handler.
Definition: Client.php:2968
+ Here is the call graph for this function: