phpCAS version 1.3.6

Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
CAS_ProxiedService_Http_Abstract Class Reference
Inheritance diagram for CAS_ProxiedService_Http_Abstract:

## Public Member Functions
| __construct (CAS_Request_RequestInterface $requestHandler, CAS_CookieJar $cookieJar)
| getServiceUrl ()
| setUrl ($url)
| send ()
| getResponseHeaders ()
| getResponseStatusCode ()
| getResponseBody ()
| getCookies ()
Public Member Functions inherited from CAS_ProxiedService_Abstract
| setProxyTicket ($proxyTicket)
| setCasClient (CAS_Client $casClient)
Public Member Functions inherited from CAS_ProxiedService
| getServiceUrl ()
| setProxyTicket ($proxyTicket)
Public Member Functions inherited from CAS_ProxiedService_Http
| setUrl ($url)
| send ()
| getResponseHeaders ()
| getResponseBody ()

## Protected Member Functions
| makeRequest ($url)
| populateRequest (CAS_Request_RequestInterface $request)
| getRedirectUrl (array $responseHeaders)
| hasBeenSent ()
Protected Member Functions inherited from CAS_ProxiedService_Abstract
| getProxyTicket ()
| initializeProxyTicket ()

## Protected Attributes
| $requestHandler

## Private Attributes
| $_cookieJar
| $_url
| $_numRequests = 0
| $_responseHeaders = array()
| $_responseStatusCode = ''
| $_responseBody = ''

## Detailed Description

This class implements common methods for ProxiedService implementations included with phpCAS.

Definition at line 41 of file Abstract.php.

## Constructor & Destructor Documentation

## ◆ __construct()

CAS_ProxiedService_Http_Abstract::__construct | ( | CAS_Request_RequestInterface | $requestHandler,
|  | CAS_CookieJar | $cookieJar
| ) |  |

Constructor.

Parameters

  CAS_Request_RequestInterface | $requestHandler | request handler object
  CAS_CookieJar | $cookieJar | cookieJar object

Returns
  void

Definition at line 66 of file Abstract.php.

References $requestHandler.

## Member Function Documentation

## ◆ getCookies()

CAS_ProxiedService_Http_Abstract::getCookies | ( |  | ) |

Answer the cookies from the response. This may include cookies set during redirect responses.

Returns
  array An array containing cookies. E.g. array('name' => 'val');

Definition at line 354 of file Abstract.php.

## ◆ getRedirectUrl()

CAS_ProxiedService_Http_Abstract::getRedirectUrl | ( | array | $responseHeaders | ) |
| protected

Answer a redirect URL if a redirect header is found, otherwise null.

Parameters

  array | $responseHeaders | response header to extract a redirect from

Returns
  string or null

Definition at line 271 of file Abstract.php.

## ◆ getResponseBody()

CAS_ProxiedService_Http_Abstract::getResponseBody | ( |  | ) |

Answer the body of response.

Returns
  string

Exceptions

  CAS_OutOfSequenceException | If called before the Request has been sent.

Definition at line 337 of file Abstract.php.

## ◆ getResponseHeaders()

CAS_ProxiedService_Http_Abstract::getResponseHeaders | ( |  | ) |

Answer the headers of the response.

Returns
  array An array of header strings.

Exceptions

  CAS_OutOfSequenceException | If called before the Request has been sent.

Definition at line 303 of file Abstract.php.

## ◆ getResponseStatusCode()

CAS_ProxiedService_Http_Abstract::getResponseStatusCode | ( |  | ) |

Answer HTTP status code of the response

Returns
  int

Exceptions

  CAS_OutOfSequenceException | If called before the Request has been sent.

Definition at line 320 of file Abstract.php.

## ◆ getServiceUrl()

CAS_ProxiedService_Http_Abstract::getServiceUrl | ( |  | ) |

Answer a service identifier (URL) for whom we should fetch a proxy ticket.

Returns
  string

Exceptions

  Exception | If no service url is available.

Definition at line 85 of file Abstract.php.

References $_url.

Referenced by send().

## ◆ hasBeenSent()

CAS_ProxiedService_Http_Abstract::hasBeenSent | ( |  | ) |
| protected

Answer true if our request has been sent yet.

Returns
  bool

Definition at line 292 of file Abstract.php.

Referenced by send(), CAS_ProxiedService_Http_Post\setBody(), CAS_ProxiedService_Http_Post\setContentType(), and setUrl().

## ◆ makeRequest()

CAS_ProxiedService_Http_Abstract::makeRequest | ( |  | $url | ) |
| protected

Build and perform a request, following redirects

Parameters

  string | $url | url for the request

Returns
  void

Exceptions

  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
  CAS_ProxiedService_Exception | If there is a failure sending the request to the target service.

Definition at line 208 of file Abstract.php.

References $requestHandler, populateRequest(), and phpCAS\trace().

Referenced by send().

## ◆ populateRequest()

CAS_ProxiedService_Http_Abstract::populateRequest | ( | CAS_Request_RequestInterface | $request | ) |
| abstract protected

Add any other parts of the request needed by concrete classes

Parameters

  CAS_Request_RequestInterface | $request | request interface object

Returns
  void

Referenced by makeRequest().

## ◆ send()

CAS_ProxiedService_Http_Abstract::send | ( |  | ) |

Perform the request.

Returns
  void

Exceptions

  CAS_OutOfSequenceException | If called multiple times.
  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
  CAS_ProxiedService_Exception | If there is a failure sending the request to the target service.

Definition at line 139 of file Abstract.php.

References CAS_ProxiedService_Abstract\getProxyTicket(), getServiceUrl(), hasBeenSent(), CAS_ProxiedService_Abstract\initializeProxyTicket(), makeRequest(), phpCAS\traceBegin(), and phpCAS\traceEnd().

## ◆ setUrl()

CAS_ProxiedService_Http_Abstract::setUrl | ( |  | $url | ) |

Set the URL of the Request

Parameters

  string | $url | url to set

Returns
  void

Exceptions

  CAS_OutOfSequenceException | If called after the Request has been sent.

Definition at line 108 of file Abstract.php.

References hasBeenSent().

## Member Data Documentation

## ◆ $_cookieJar

CAS_CookieJar CAS_ProxiedService_Http_Abstract::$_cookieJar
| private

The storage mechanism for cookies set by the target service.

Definition at line 56 of file Abstract.php.

## ◆ $_numRequests

int CAS_ProxiedService_Http_Abstract::$_numRequests = 0
| private

Indicator of the number of requests (including redirects performed.

Definition at line 171 of file Abstract.php.

## ◆ $_responseBody

string CAS_ProxiedService_Http_Abstract::$_responseBody = ''
| private

The response headers.

Definition at line 192 of file Abstract.php.

## ◆ $_responseHeaders

array CAS_ProxiedService_Http_Abstract::$_responseHeaders = array()
| private

The response headers.

Definition at line 178 of file Abstract.php.

## ◆ $_responseStatusCode

string CAS_ProxiedService_Http_Abstract::$_responseStatusCode = ''
| private

The response status code.

Definition at line 185 of file Abstract.php.

## ◆ $_url

string CAS_ProxiedService_Http_Abstract::$_url
| private

The target service url.

Definition at line 77 of file Abstract.php.

Referenced by getServiceUrl().

## ◆ $requestHandler

CAS_Request_RequestInterface CAS_ProxiedService_Http_Abstract::$requestHandler
| protected

The HTTP request mechanism talking to the target service.

Definition at line 49 of file Abstract.php.

Referenced by __construct(), and makeRequest().