ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Miscellaneous
+ Collaboration diagram for Miscellaneous:

Functions

 CAS_Client::_readURL ($url, &$headers, &$body, &$err_msg)
 This method is used to acces a remote URL. More...
 
 CAS_Client::_buildSAMLPayload ()
 This method is used to build the SAML POST body sent to /samlValidate URL. More...
 
 CAS_Client::setURL ($url)
 This method sets the URL of the current request. More...
 
 CAS_Client::getURL ()
 This method returns the URL of the current request (without any ticket CGI parameter). More...
 
 CAS_Client::setBaseURL ($url)
 This method sets the base URL of the CAS server. More...
 
 CAS_Client::_getClientUrl ()
 Try to figure out the phpCas client URL with possible Proxys / Ports etc. More...
 
 CAS_Client::_isHttps ()
 This method checks to see if the request is secured via HTTPS. More...
 
 CAS_Client::_removeParameterFromQueryString ($parameterName, $queryString)
 Removes a parameter from a query string. More...
 
 CAS_Client::_buildQueryUrl ($url, $query)
 This method is used to append query parameters to an url. More...
 
 CAS_Client::_renameSession ($ticket)
 Renaming the session. More...
 
 CAS_Client::_authError ( $failure, $cas_url, $no_response, $bad_response='', $cas_response='', $err_code='', $err_msg='')
 This method is used to print the HTML output when the user was not authenticated. More...
 
 CAS_Client::_getNodeType ($nodeURL)
 Determine the node type from the URL. More...
 
 CAS_Client::addRebroadcastNode ($rebroadcastNodeUrl)
 Store the rebroadcast node for pgtIou/pgtId and logout requests. More...
 
 CAS_Client::addRebroadcastHeader ($header)
 This method is used to add header parameters when rebroadcasting pgtIou/pgtId or logoutRequest. More...
 
 CAS_Client::_rebroadcast ($type)
 This method rebroadcasts logout/pgtIou requests. More...
 

Variables

 CAS_Client::$_url
 the URL of the current request (without any ticket CGI parameter). More...
 
 CAS_Client::$_rebroadcast = false
 Boolean of whether to rebroadcast pgtIou/pgtId and logoutRequest, and array of the nodes. More...
 
 CAS_Client::$_rebroadcast_nodes = array()
 
const CAS_Client::HOSTNAME = 0
 Constants used for determining rebroadcast node type. More...
 
const CAS_Client::IP = 1
 
 CAS_Client::$_rebroadcast_headers = array()
 An array to store extra rebroadcast curl options. More...
 
const CAS_Client::LOGOUT = 0
 Constants used for determining rebroadcast type (logout or pgtIou/pgtId). More...
 
const CAS_Client::PGTIOU = 1
 

Detailed Description

Function Documentation

◆ _authError()

CAS_Client::_authError (   $failure,
  $cas_url,
  $no_response,
  $bad_response = '',
  $cas_response = '',
  $err_code = '',
  $err_msg = '' 
)
private

This method is used to print the HTML output when the user was not authenticated.

Parameters
string$failurethe failure that occured
string$cas_urlthe URL the CAS server was asked for
bool$no_responsethe response from the CAS server (other parameters are ignored if true)
bool$bad_responsebad response from the CAS server ($err_code and $err_msg ignored if true)
string$cas_responsethe response of the CAS server
int$err_codethe error code given by the CAS server
string$err_msgthe error message given by the CAS server
Returns
void

Definition at line 3849 of file Client.php.

References $_SERVER, $failure, $lang, CAS_VERSION_1_0, CAS_VERSION_2_0, CAS_VERSION_3_0, CAS_Client\getLangObj(), CAS_Client\getServerVersion(), CAS_Client\getURL(), CAS_Client\printHTMLFooter(), CAS_Client\printHTMLHeader(), phpCAS\trace(), phpCAS\traceBegin(), and phpCAS\traceExit().

3857  {
3859  $lang = $this->getLangObj();
3860  $this->printHTMLHeader($lang->getAuthenticationFailed());
3861  printf(
3862  $lang->getYouWereNotAuthenticated(),
3863  htmlentities($this->getURL()),
3864  isset($_SERVER['SERVER_ADMIN']) ? $_SERVER['SERVER_ADMIN']:''
3865  );
3866  phpCAS::trace('CAS URL: ' . $cas_url);
3867  phpCAS::trace('Authentication failure: ' . $failure);
3868  if ($no_response) {
3869  phpCAS::trace('Reason: no response from the CAS server');
3870  } else {
3871  if ($bad_response) {
3872  phpCAS::trace('Reason: bad response from the CAS server');
3873  } else {
3874  switch ($this->getServerVersion()) {
3875  case CAS_VERSION_1_0:
3876  phpCAS::trace('Reason: CAS error');
3877  break;
3878  case CAS_VERSION_2_0:
3879  case CAS_VERSION_3_0:
3880  if (empty($err_code)) {
3881  phpCAS::trace('Reason: no CAS error');
3882  } else {
3883  phpCAS::trace(
3884  'Reason: [' . $err_code . '] CAS error: ' . $err_msg
3885  );
3886  }
3887  break;
3888  }
3889  }
3890  phpCAS::trace('CAS response: ' . $cas_response);
3891  }
3892  $this->printHTMLFooter();
3895  }
getLangObj()
Create the language.
Definition: Client.php:226
$failure
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
const CAS_VERSION_1_0
CAS version 1.0.
Definition: CAS.php:74
printHTMLFooter()
This method prints the footer of the HTML output (after filtering).
Definition: Client.php:130
static traceExit()
This method is used to indicate the end of the execution of the program.
Definition: CAS.php:681
const CAS_VERSION_3_0
CAS version 3.0.
Definition: CAS.php:82
static trace($str)
This method is used to log something in debug mode.
Definition: CAS.php:599
const CAS_VERSION_2_0
Definition: CAS.php:78
printHTMLHeader($title)
This method prints the header of the HTML output (after filtering).
Definition: Client.php:101
getURL()
This method returns the URL of the current request (without any ticket CGI parameter).
Definition: Client.php:3648
getServerVersion()
This method is used to retrieve the version of the CAS server.
Definition: Client.php:277
static traceBegin()
This method is used to indicate the start of the execution of a function in debug mode...
Definition: CAS.php:611
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Definition: langwiz.php:349
+ Here is the call graph for this function:

◆ _buildQueryUrl()

CAS_Client::_buildQueryUrl (   $url,
  $query 
)
private

This method is used to append query parameters to an url.

Since the url might already contain parameter it has to be detected and to build a proper URL

Parameters
string$urlbase url to add the query params to
string$queryparams in query form with & separated
Returns
url with query params

Definition at line 3787 of file Client.php.

References $query, and $url.

Referenced by CAS_Client\getServerLoginURL(), CAS_Client\getServerProxyValidateURL(), CAS_Client\getServerSamlValidateURL(), and CAS_Client\getServerServiceValidateURL().

3788  {
3789  $url .= (strstr($url, '?') === false) ? '?' : '&';
3790  $url .= $query;
3791  return $url;
3792  }
$query
$url
+ Here is the caller graph for this function:

◆ _buildSAMLPayload()

CAS_Client::_buildSAMLPayload ( )
private

This method is used to build the SAML POST body sent to /samlValidate URL.

Returns
the SOAP-encased SAMLP artifact (the ticket).

Definition at line 2931 of file Client.php.

References CAS_Client\getTicket(), SAML_ASSERTION_ARTIFACT, SAML_ASSERTION_ARTIFACT_CLOSE, SAML_SOAP_BODY, SAML_SOAP_BODY_CLOSE, SAML_SOAP_ENV, SAML_SOAP_ENV_CLOSE, SAMLP_REQUEST, SAMLP_REQUEST_CLOSE, phpCAS\traceBegin(), and phpCAS\traceEnd().

Referenced by CAS_Client\_readURL().

2932  {
2934 
2935  //get the ticket
2936  $sa = urlencode($this->getTicket());
2937 
2941 
2942  phpCAS::traceEnd($body);
2943  return ($body);
2944  }
const SAML_SOAP_BODY_CLOSE
SOAP body close.
Definition: CAS.php:127
const SAML_SOAP_ENV
SOAP envelope for SAML POST.
Definition: CAS.php:101
const SAML_SOAP_ENV_CLOSE
SOAP envelope close.
Definition: CAS.php:132
const SAML_ASSERTION_ARTIFACT_CLOSE
SAMLP close.
Definition: CAS.php:122
static traceEnd($res='')
This method is used to indicate the end of the execution of a function in debug mode.
Definition: CAS.php:658
getTicket()
This method returns the Service Ticket provided in the URL of the request.
Definition: Client.php:1905
const SAML_ASSERTION_ARTIFACT
SAMLP artifact tag (for the ticket)
Definition: CAS.php:117
const SAMLP_REQUEST
SAMLP request.
Definition: CAS.php:111
const SAMLP_REQUEST_CLOSE
Definition: CAS.php:112
static traceBegin()
This method is used to indicate the start of the execution of a function in debug mode...
Definition: CAS.php:611
const SAML_SOAP_BODY
SOAP body for SAML POST.
Definition: CAS.php:106
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getClientUrl()

CAS_Client::_getClientUrl ( )
private

Try to figure out the phpCas client URL with possible Proxys / Ports etc.

Returns
string Server URL with domain:port

Definition at line 3702 of file Client.php.

References $_SERVER, and CAS_Client\_isHttps().

Referenced by CAS_Client\_getCallbackURL(), and CAS_Client\getURL().

3703  {
3704  $server_url = '';
3705  if (!empty($_SERVER['HTTP_X_FORWARDED_HOST'])) {
3706  // explode the host list separated by comma and use the first host
3707  $hosts = explode(',', $_SERVER['HTTP_X_FORWARDED_HOST']);
3708  // see rfc7239#5.3 and rfc7230#2.7.1: port is in HTTP_X_FORWARDED_HOST if non default
3709  return $hosts[0];
3710  } elseif (!empty($_SERVER['HTTP_X_FORWARDED_SERVER'])) {
3711  $server_url = $_SERVER['HTTP_X_FORWARDED_SERVER'];
3712  } else {
3713  if (empty($_SERVER['SERVER_NAME'])) {
3714  $server_url = $_SERVER['HTTP_HOST'];
3715  } else {
3716  $server_url = $_SERVER['SERVER_NAME'];
3717  }
3718  }
3719  if (!strpos($server_url, ':')) {
3720  if (empty($_SERVER['HTTP_X_FORWARDED_PORT'])) {
3721  $server_port = $_SERVER['SERVER_PORT'];
3722  } else {
3723  $ports = explode(',', $_SERVER['HTTP_X_FORWARDED_PORT']);
3724  $server_port = $ports[0];
3725  }
3726 
3727  if (($this->_isHttps() && $server_port != 443)
3728  || (!$this->_isHttps() && $server_port != 80)
3729  ) {
3730  $server_url .= ':';
3731  $server_url .= $server_port;
3732  }
3733  }
3734  return $server_url;
3735  }
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
_isHttps()
This method checks to see if the request is secured via HTTPS.
Definition: Client.php:3742
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getNodeType()

CAS_Client::_getNodeType (   $nodeURL)
private

Determine the node type from the URL.

Parameters
String$nodeURLThe node URL.
Returns
string hostname

Definition at line 3922 of file Client.php.

References phpCAS\traceBegin(), and phpCAS\traceEnd().

Referenced by CAS_Client\_rebroadcast().

3923  {
3925  if (preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/", $nodeURL)) {
3926  phpCAS::traceEnd(self::IP);
3927  return self::IP;
3928  } else {
3929  phpCAS::traceEnd(self::HOSTNAME);
3930  return self::HOSTNAME;
3931  }
3932  }
static traceEnd($res='')
This method is used to indicate the end of the execution of a function in debug mode.
Definition: CAS.php:658
static traceBegin()
This method is used to indicate the start of the execution of a function in debug mode...
Definition: CAS.php:611
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _isHttps()

CAS_Client::_isHttps ( )
private

This method checks to see if the request is secured via HTTPS.

Returns
bool true if https, false otherwise

Definition at line 3742 of file Client.php.

References $_SERVER.

Referenced by CAS_Client\__construct(), CAS_Client\_getClientUrl(), and CAS_Client\getURL().

3743  {
3744  if (!empty($_SERVER['HTTP_X_FORWARDED_PROTO'])) {
3745  return ($_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https');
3746  } elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTOCOL'])) {
3747  return ($_SERVER['HTTP_X_FORWARDED_PROTOCOL'] === 'https');
3748  } elseif (isset($_SERVER['HTTPS'])
3749  && !empty($_SERVER['HTTPS'])
3750  && strcasecmp($_SERVER['HTTPS'], 'off') !== 0
3751  ) {
3752  return true;
3753  }
3754  return false;
3755  }
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
+ Here is the caller graph for this function:

◆ _readURL()

CAS_Client::_readURL (   $url,
$headers,
$body,
$err_msg 
)
private

This method is used to acces a remote URL.

Parameters
string$urlthe URL to access.
string&$headersan array containing the HTTP header lines of the response (an empty array on failure).
string&$bodythe body of the response, as a string (empty on failure).
string&$err_msgan error message, filled on failure.
Returns
true on success, false otherwise (in this later case, $err_msg contains an error message).

Definition at line 2875 of file Client.php.

References CAS_Client\$_requestImplementation, $request, $url, CAS_Client\_buildSAMLPayload(), phpCAS\error(), CAS_Client\getServerVersion(), SAML_VERSION_1_1, phpCAS\traceBegin(), and phpCAS\traceEnd().

Referenced by CAS_Client\retrievePT(), CAS_Client\validateCAS10(), and CAS_Client\validateCAS20().

2876  {
2878  $className = $this->_requestImplementation;
2879  $request = new $className();
2880 
2881  if (count($this->_curl_options)) {
2882  $request->setCurlOptions($this->_curl_options);
2883  }
2884 
2885  $request->setUrl($url);
2886 
2887  if (empty($this->_cas_server_ca_cert) && !$this->_no_cas_server_validation) {
2888  phpCAS::error(
2889  'one of the methods phpCAS::setCasServerCACert() or phpCAS::setNoCasServerValidation() must be called.'
2890  );
2891  }
2892  if ($this->_cas_server_ca_cert != '') {
2893  $request->setSslCaCert(
2894  $this->_cas_server_ca_cert,
2895  $this->_cas_server_cn_validate
2896  );
2897  }
2898 
2899  // add extra stuff if SAML
2900  if ($this->getServerVersion() == SAML_VERSION_1_1) {
2901  $request->addHeader("soapaction: http://www.oasis-open.org/committees/security");
2902  $request->addHeader("cache-control: no-cache");
2903  $request->addHeader("pragma: no-cache");
2904  $request->addHeader("accept: text/xml");
2905  $request->addHeader("connection: keep-alive");
2906  $request->addHeader("content-type: text/xml");
2907  $request->makePost();
2908  $request->setPostBody($this->_buildSAMLPayload());
2909  }
2910 
2911  if ($request->send()) {
2912  $headers = $request->getResponseHeaders();
2913  $body = $request->getResponseBody();
2914  $err_msg = '';
2915  phpCAS::traceEnd(true);
2916  return true;
2917  } else {
2918  $headers = '';
2919  $body = '';
2920  $err_msg = $request->getErrorMessage();
2921  phpCAS::traceEnd(false);
2922  return false;
2923  }
2924  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
static error($msg)
This method is used by interface methods to print an error and where the function was originally call...
Definition: CAS.php:563
const SAML_VERSION_1_1
SAML protocol.
Definition: CAS.php:91
static traceEnd($res='')
This method is used to indicate the end of the execution of a function in debug mode.
Definition: CAS.php:658
_buildSAMLPayload()
This method is used to build the SAML POST body sent to /samlValidate URL.
Definition: Client.php:2931
getServerVersion()
This method is used to retrieve the version of the CAS server.
Definition: Client.php:277
static traceBegin()
This method is used to indicate the start of the execution of a function in debug mode...
Definition: CAS.php:611
$url
$_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:

◆ _rebroadcast()

CAS_Client::_rebroadcast (   $type)
private

This method rebroadcasts logout/pgtIou requests.

Can be LOGOUT,PGTIOU

Parameters
int$typetype of rebroadcasting.
Returns
void

Definition at line 3988 of file Client.php.

References $_POST, CAS_Client\$_rebroadcast_nodes, CAS_Client\$_requestImplementation, $_SERVER, $i, $request, $type, $url, CAS_Client\_getNodeType(), phpCAS\trace(), phpCAS\traceBegin(), and phpCAS\traceEnd().

Referenced by CAS_Client\_wasPreviouslyAuthenticated(), CAS_Client\addRebroadcastNode(), and CAS_Client\handleLogoutRequests().

3989  {
3991 
3992  $rebroadcast_curl_options = array(
3993  CURLOPT_FAILONERROR => 1,
3994  CURLOPT_FOLLOWLOCATION => 1,
3995  CURLOPT_RETURNTRANSFER => 1,
3996  CURLOPT_CONNECTTIMEOUT => 1,
3997  CURLOPT_TIMEOUT => 4);
3998 
3999  // Try to determine the IP address of the server
4000  if (!empty($_SERVER['SERVER_ADDR'])) {
4001  $ip = $_SERVER['SERVER_ADDR'];
4002  } elseif (!empty($_SERVER['LOCAL_ADDR'])) {
4003  // IIS 7
4004  $ip = $_SERVER['LOCAL_ADDR'];
4005  }
4006  // Try to determine the DNS name of the server
4007  if (!empty($ip)) {
4008  $dns = gethostbyaddr($ip);
4009  }
4010  $multiClassName = 'CAS_Request_CurlMultiRequest';
4011  $multiRequest = new $multiClassName();
4012 
4013  for ($i = 0; $i < sizeof($this->_rebroadcast_nodes); $i++) {
4014  if ((($this->_getNodeType($this->_rebroadcast_nodes[$i]) == self::HOSTNAME) && !empty($dns) && (stripos($this->_rebroadcast_nodes[$i], $dns) === false))
4015  || (($this->_getNodeType($this->_rebroadcast_nodes[$i]) == self::IP) && !empty($ip) && (stripos($this->_rebroadcast_nodes[$i], $ip) === false))
4016  ) {
4017  phpCAS::trace(
4018  'Rebroadcast target URL: ' . $this->_rebroadcast_nodes[$i]
4019  . $_SERVER['REQUEST_URI']
4020  );
4021  $className = $this->_requestImplementation;
4022  $request = new $className();
4023 
4024  $url = $this->_rebroadcast_nodes[$i] . $_SERVER['REQUEST_URI'];
4025  $request->setUrl($url);
4026 
4027  if (count($this->_rebroadcast_headers)) {
4028  $request->addHeaders($this->_rebroadcast_headers);
4029  }
4030 
4031  $request->makePost();
4032  if ($type == self::LOGOUT) {
4033  // Logout request
4034  $request->setPostBody(
4035  'rebroadcast=false&logoutRequest=' . $_POST['logoutRequest']
4036  );
4037  } elseif ($type == self::PGTIOU) {
4038  // pgtIou/pgtId rebroadcast
4039  $request->setPostBody('rebroadcast=false');
4040  }
4041 
4042  $request->setCurlOptions($rebroadcast_curl_options);
4043 
4044  $multiRequest->addRequest($request);
4045  } else {
4046  phpCAS::trace(
4047  'Rebroadcast not sent to self: '
4048  . $this->_rebroadcast_nodes[$i] . ' == ' . (!empty($ip)?$ip:'')
4049  . '/' . (!empty($dns)?$dns:'')
4050  );
4051  }
4052  }
4053  // We need at least 1 request
4054  if ($multiRequest->getNumRequests() > 0) {
4055  $multiRequest->send();
4056  }
4057  phpCAS::traceEnd();
4058  }
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
foreach($paths as $path) $request
Definition: asyncclient.php:32
$type
static traceEnd($res='')
This method is used to indicate the end of the execution of a function in debug mode.
Definition: CAS.php:658
static trace($str)
This method is used to log something in debug mode.
Definition: CAS.php:599
_getNodeType($nodeURL)
Determine the node type from the URL.
Definition: Client.php:3922
$_rebroadcast_nodes
Definition: Client.php:3906
static traceBegin()
This method is used to indicate the start of the execution of a function in debug mode...
Definition: CAS.php:611
$i
Definition: disco.tpl.php:19
$url
$_requestImplementation
The class to instantiate for making web requests in readUrl().
Definition: Client.php:610
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _removeParameterFromQueryString()

CAS_Client::_removeParameterFromQueryString (   $parameterName,
  $queryString 
)
private

Removes a parameter from a query string.

Parameters
string$parameterNamename of parameter
string$queryStringquery string
Returns
string new query string

http://stackoverflow.com/questions/1842681/regular-expression-to-remove-one-parameter-from-query-string

Definition at line 3767 of file Client.php.

Referenced by CAS_Client\getURL().

3768  {
3769  $parameterName = preg_quote($parameterName);
3770  return preg_replace(
3771  "/&$parameterName(=[^&]*)?|^$parameterName(=[^&]*)?&?/",
3772  '',
3773  $queryString
3774  );
3775  }
+ Here is the caller graph for this function:

◆ _renameSession()

CAS_Client::_renameSession (   $ticket)
private

Renaming the session.

Parameters
string$ticketname of the ticket
Returns
void

Definition at line 3801 of file Client.php.

References $_SESSION, CAS_Client\getChangeSessionID(), phpCAS\trace(), phpCAS\traceBegin(), and phpCAS\traceEnd().

Referenced by CAS_Client\validateSA().

3802  {
3804  if ($this->getChangeSessionID()) {
3805  if (!empty($this->_user)) {
3806  $old_session = $_SESSION;
3807  phpCAS :: trace("Killing session: " . session_id());
3808  session_destroy();
3809  // set up a new session, of name based on the ticket
3810  $session_id = preg_replace('/[^a-zA-Z0-9\-]/', '', $ticket);
3811  phpCAS :: trace("Starting session: " . $session_id);
3812  session_id($session_id);
3813  session_start();
3814  phpCAS :: trace("Restoring old session vars");
3815  $_SESSION = $old_session;
3816  } else {
3818  'Session should only be renamed after successfull authentication'
3819  );
3820  }
3821  } else {
3823  "Skipping session rename since phpCAS is not handling the session."
3824  );
3825  }
3826  phpCAS::traceEnd();
3827  }
$_SESSION["AccountId"]
static traceEnd($res='')
This method is used to indicate the end of the execution of a function in debug mode.
Definition: CAS.php:658
static trace($str)
This method is used to log something in debug mode.
Definition: CAS.php:599
getChangeSessionID()
Get whether phpCas is allowed to change session_id.
Definition: Client.php:1088
static traceBegin()
This method is used to indicate the start of the execution of a function in debug mode...
Definition: CAS.php:611
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addRebroadcastHeader()

CAS_Client::addRebroadcastHeader (   $header)

This method is used to add header parameters when rebroadcasting pgtIou/pgtId or logoutRequest.

Parameters
string$headerHeader to send when rebroadcasting.
Returns
void

Definition at line 3966 of file Client.php.

References $header.

3967  {
3968  if (gettype($header) != 'string') {
3969  throw new CAS_TypeMismatchException($header, '$header', 'string');
3970  }
3971 
3972  $this->_rebroadcast_headers[] = $header;
3973  }

◆ addRebroadcastNode()

CAS_Client::addRebroadcastNode (   $rebroadcastNodeUrl)

Store the rebroadcast node for pgtIou/pgtId and logout requests.

Parameters
string$rebroadcastNodeUrlThe rebroadcast node URL.
Returns
void

Definition at line 3941 of file Client.php.

References CAS_Client\_rebroadcast().

3942  {
3943  // Argument validation
3944  if (!(bool) preg_match("/^(http|https):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i", $rebroadcastNodeUrl)) {
3945  throw new CAS_TypeMismatchException($rebroadcastNodeUrl, '$rebroadcastNodeUrl', 'url');
3946  }
3947 
3948  // Store the rebroadcast node and set flag
3949  $this->_rebroadcast = true;
3950  $this->_rebroadcast_nodes[] = $rebroadcastNodeUrl;
3951  }
_rebroadcast($type)
This method rebroadcasts logout/pgtIou requests.
Definition: Client.php:3988
+ Here is the call graph for this function:

◆ getURL()

CAS_Client::getURL ( )

This method returns the URL of the current request (without any ticket CGI parameter).

Returns
The URL

Definition at line 3648 of file Client.php.

References $_SERVER, CAS_Client\$_url, CAS_Client\_getClientUrl(), CAS_Client\_isHttps(), CAS_Client\_removeParameterFromQueryString(), CAS_Client\setURL(), phpCAS\trace(), phpCAS\traceBegin(), and phpCAS\traceEnd().

Referenced by CAS_Client\_authError(), CAS_Client\getServerLoginURL(), CAS_Client\getServerProxyValidateURL(), CAS_Client\getServerSamlValidateURL(), CAS_Client\getServerServiceValidateURL(), and CAS_Client\isAuthenticated().

3649  {
3651  // the URL is built when needed only
3652  if (empty($this->_url)) {
3653  $final_uri = '';
3654  // remove the ticket if present in the URL
3655  $final_uri = ($this->_isHttps()) ? 'https' : 'http';
3656  $final_uri .= '://';
3657 
3658  $final_uri .= $this->_getClientUrl();
3659  $request_uri = explode('?', $_SERVER['REQUEST_URI'], 2);
3660  $final_uri .= $request_uri[0];
3661 
3662  if (isset($request_uri[1]) && $request_uri[1]) {
3663  $query_string = $this->_removeParameterFromQueryString('ticket', $request_uri[1]);
3664 
3665  // If the query string still has anything left,
3666  // append it to the final URI
3667  if ($query_string !== '') {
3668  $final_uri .= "?$query_string";
3669  }
3670  }
3671 
3672  phpCAS::trace("Final URI: $final_uri");
3673  $this->setURL($final_uri);
3674  }
3675  phpCAS::traceEnd($this->_url);
3676  return $this->_url;
3677  }
_getClientUrl()
Try to figure out the phpCas client URL with possible Proxys / Ports etc.
Definition: Client.php:3702
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
_removeParameterFromQueryString($parameterName, $queryString)
Removes a parameter from a query string.
Definition: Client.php:3767
static traceEnd($res='')
This method is used to indicate the end of the execution of a function in debug mode.
Definition: CAS.php:658
static trace($str)
This method is used to log something in debug mode.
Definition: CAS.php:599
_isHttps()
This method checks to see if the request is secured via HTTPS.
Definition: Client.php:3742
setURL($url)
This method sets the URL of the current request.
Definition: Client.php:3632
$_url
the URL of the current request (without any ticket CGI parameter).
Definition: Client.php:3622
static traceBegin()
This method is used to indicate the start of the execution of a function in debug mode...
Definition: CAS.php:611
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setBaseURL()

CAS_Client::setBaseURL (   $url)

This method sets the base URL of the CAS server.

Parameters
string$urlthe base URL
Returns
string base url

Definition at line 3686 of file Client.php.

References $url.

3687  {
3688  // Argument Validation
3689  if (gettype($url) != 'string') {
3690  throw new CAS_TypeMismatchException($url, '$url', 'string');
3691  }
3692 
3693  return $this->_server['base_url'] = $url;
3694  }
$url

◆ setURL()

CAS_Client::setURL (   $url)

This method sets the URL of the current request.

Parameters
string$urlurl to set for service
Returns
void

Definition at line 3632 of file Client.php.

References $url.

Referenced by CAS_Client\getURL().

3633  {
3634  // Argument Validation
3635  if (gettype($url) != 'string') {
3636  throw new CAS_TypeMismatchException($url, '$url', 'string');
3637  }
3638 
3639  $this->_url = $url;
3640  }
$url
+ Here is the caller graph for this function:

Variable Documentation

◆ $_rebroadcast

CAS_Client::$_rebroadcast = false
private

Boolean of whether to rebroadcast pgtIou/pgtId and logoutRequest, and array of the nodes.

Definition at line 3905 of file Client.php.

◆ $_rebroadcast_headers

CAS_Client::$_rebroadcast_headers = array()
private

An array to store extra rebroadcast curl options.

Definition at line 3956 of file Client.php.

◆ $_rebroadcast_nodes

CAS_Client::$_rebroadcast_nodes = array()
private

Definition at line 3906 of file Client.php.

Referenced by CAS_Client\_rebroadcast().

◆ $_url

CAS_Client::$_url
private

the URL of the current request (without any ticket CGI parameter).

Written and read by CAS_Client::getURL().

Definition at line 3622 of file Client.php.

Referenced by CAS_Client\getURL().

◆ HOSTNAME

const CAS_Client::HOSTNAME = 0

Constants used for determining rebroadcast node type.

Definition at line 3911 of file Client.php.

◆ IP

const CAS_Client::IP = 1

Definition at line 3912 of file Client.php.

◆ LOGOUT

const CAS_Client::LOGOUT = 0

Constants used for determining rebroadcast type (logout or pgtIou/pgtId).

Definition at line 3978 of file Client.php.

◆ PGTIOU

const CAS_Client::PGTIOU = 1

Definition at line 3979 of file Client.php.