phpCAS  version 1.4.0
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:
CAS_ProxiedService_Abstract CAS_ProxiedService_Http CAS_ProxiedService CAS_ProxiedService_Testable CAS_ProxiedService_Http_Get CAS_ProxiedService_Http_Post

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$requestHandlerrequest handler object
CAS_CookieJar$cookieJarcookieJar 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$responseHeadersresponse header to extract a redirect from
Returns
string|null

Definition at line 271 of file Abstract.php.

◆ getResponseBody()

CAS_ProxiedService_Http_Abstract::getResponseBody ( )

Answer the body of response.

Returns
string
Exceptions
CAS_OutOfSequenceExceptionIf 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_OutOfSequenceExceptionIf 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_OutOfSequenceExceptionIf 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
ExceptionIf 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$urlurl for the request
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 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)
abstractprotected

Add any other parts of the request needed by concrete classes

Parameters
CAS_Request_RequestInterface$requestrequest interface object
Returns
void

Referenced by makeRequest().

◆ send()

CAS_ProxiedService_Http_Abstract::send ( )

Perform the request.

Returns
void
Exceptions
CAS_OutOfSequenceExceptionIf called multiple times.
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 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$urlurl to set
Returns
void
Exceptions
CAS_OutOfSequenceExceptionIf 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

int 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().