ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
+ Collaboration diagram for Miscellaneous:

Functions

 CASClient::getURL ()
 This method returns the URL of the current request (without any ticket CGI parameter). More...
 
 CASClient::removeParameterFromQueryString ($parameterName, $queryString)
 Removes a parameter from a query string. More...
 
 CASClient::setURL ($url)
 This method sets the URL of the current request. More...
 
 CASClient::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...
 

Variables

 CASClient::$_url
 the URL of the current request (without any ticket CGI parameter). More...
 
 $GLOBALS ['PHPCAS_CLIENT']
 This global variable is used by the interface class phpCAS. More...
 
 $GLOBALS ['PHPCAS_INIT_CALL']
 This global variable is used to store where the initializer is called from (to print a comprehensive error in case of multiple calls). More...
 
 $GLOBALS ['PHPCAS_AUTH_CHECK_CALL']
 This global variable is used to store where the method checking the authentication is called from (to print comprehensive errors) More...
 
 $GLOBALS ['PHPCAS_DEBUG']
 This global variable is used to store phpCAS debug mode. More...
 
 $PHPCAS_CLIENT
 This global variable is used by the interface class phpCAS. More...
 
 $PHPCAS_INIT_CALL
 This global variable is used to store where the initializer is called from (to print a comprehensive error in case of multiple calls). More...
 
 $PHPCAS_AUTH_CHECK_CALL
 This global variable is used to store where the method checking the authentication is called from (to print comprehensive errors) More...
 
 $PHPCAS_DEBUG
 This global variable is used to store phpCAS debug mode. More...
 

Detailed Description

Function Documentation

◆ authError()

CASClient::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
$failurethe failure that occured
$cas_urlthe URL the CAS server was asked for
$no_responsethe response from the CAS server (other parameters are ignored if TRUE)
$bad_responsebad response from the CAS server ($err_code and $err_msg ignored if TRUE)
$cas_responsethe response of the CAS server
$err_codethe error code given by the CAS server
$err_msgthe error message given by the CAS server

Definition at line 2722 of file client.php.

References $failure, CAS_STR_AUTHENTICATION_FAILED, CAS_STR_YOU_WERE_NOT_AUTHENTICATED, CAS_VERSION_1_0, CAS_VERSION_2_0, exit, CASClient\getServerVersion(), CASClient\getString(), CASClient\getURL(), CASClient\printHTMLFooter(), CASClient\printHTMLHeader(), phpCAS\trace(), phpCAS\traceBegin(), and phpCAS\traceExit().

Referenced by CASClient\validatePGT(), CASClient\validateSA(), and CASClient\validateST().

2723  {
2725 
2727  printf($this->getString(CAS_STR_YOU_WERE_NOT_AUTHENTICATED),htmlentities($this->getURL()),$_SERVER['SERVER_ADMIN']);
2728  phpCAS::trace('CAS URL: '.$cas_url);
2729  phpCAS::trace('Authentication failure: '.$failure);
2730  if ( $no_response ) {
2731  phpCAS::trace('Reason: no response from the CAS server');
2732  } else {
2733  if ( $bad_response ) {
2734  phpCAS::trace('Reason: bad response from the CAS server');
2735  } else {
2736  switch ($this->getServerVersion()) {
2737  case CAS_VERSION_1_0:
2738  phpCAS::trace('Reason: CAS error');
2739  break;
2740  case CAS_VERSION_2_0:
2741  if ( empty($err_code) )
2742  phpCAS::trace('Reason: no CAS error');
2743  else
2744  phpCAS::trace('Reason: ['.$err_code.'] CAS error: '.$err_msg);
2745  break;
2746  }
2747  }
2748  phpCAS::trace('CAS response: '.$cas_response);
2749  }
2750  $this->printHTMLFooter();
2752  exit();
2753  }
getURL()
This method returns the URL of the current request (without any ticket CGI parameter).
Definition: client.php:2621
$failure
exit
Definition: login.php:54
getServerVersion()
This method is used to retrieve the version of the CAS server.
Definition: client.php:297
const CAS_VERSION_1_0
CAS version 1.0.
Definition: CAS.php:77
const CAS_STR_YOU_WERE_NOT_AUTHENTICATED
Definition: languages.php:20
getString($str)
This method returns a string depending on the language.
Definition: client.php:221
printHTMLHeader($title)
This method prints the header of the HTML output (after filtering).
Definition: client.php:108
traceBegin()
This method is used to indicate the start of the execution of a function in debug mode...
Definition: CAS.php:577
const CAS_VERSION_2_0
Definition: CAS.php:81
printHTMLFooter()
This method prints the footer of the HTML output (after filtering).
Definition: client.php:136
trace($str)
This method is used to log something in debug mode.
Definition: CAS.php:569
const CAS_STR_AUTHENTICATION_FAILED
Definition: languages.php:19
traceExit()
This method is used to indicate the end of the execution of the program.
Definition: CAS.php:617
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getURL()

CASClient::getURL ( )
private

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

Returns
The URL

Definition at line 2621 of file client.php.

References CASClient\$_url, CASClient\isHttps(), CASClient\removeParameterFromQueryString(), CASClient\setURL(), phpCAS\trace(), and phpCAS\traceEnd().

Referenced by CASClient\authError(), CASClient\getServerLoginURL(), CASClient\getServerProxyValidateURL(), CASClient\getServerSamlValidateURL(), CASClient\getServerServiceValidateURL(), and CASClient\isAuthenticated().

2622  {
2624  // the URL is built when needed only
2625  if ( empty($this->_url) ) {
2626  $final_uri = '';
2627  // remove the ticket if present in the URL
2628  $final_uri = ($this->isHttps()) ? 'https' : 'http';
2629  $final_uri .= '://';
2630  /* replaced by Julien Marchal - v0.4.6
2631  * $this->_url .= $_SERVER['SERVER_NAME'];
2632  */
2633  if(empty($_SERVER['HTTP_X_FORWARDED_SERVER'])){
2634  /* replaced by teedog - v0.4.12
2635  * $this->_url .= $_SERVER['SERVER_NAME'];
2636  */
2637  if (empty($_SERVER['SERVER_NAME'])) {
2638  $server_name = $_SERVER['HTTP_HOST'];
2639  } else {
2640  $server_name = $_SERVER['SERVER_NAME'];
2641  }
2642  } else {
2643  $server_name = $_SERVER['HTTP_X_FORWARDED_SERVER'];
2644  }
2645  $final_uri .= $server_name;
2646  if (!strpos($server_name, ':')) {
2647  if ( ($this->isHttps() && $_SERVER['SERVER_PORT']!=443)
2648  || (!$this->isHttps() && $_SERVER['SERVER_PORT']!=80) ) {
2649  $final_uri .= ':';
2650  $final_uri .= $_SERVER['SERVER_PORT'];
2651  }
2652  }
2653 
2654  $request_uri = explode('?', $_SERVER['REQUEST_URI'], 2);
2655  $final_uri .= $request_uri[0];
2656 
2657  if (isset($request_uri[1]) && $request_uri[1])
2658  {
2659  $query_string = $this->removeParameterFromQueryString('ticket', $request_uri[1]);
2660 
2661  // If the query string still has anything left, append it to the final URI
2662  if ($query_string !== '')
2663  $final_uri .= "?$query_string";
2664 
2665  }
2666 
2667  phpCAS::trace("Final URI: $final_uri");
2668  $this->setURL($final_uri);
2669  }
2670  phpCAS::traceEnd($this->_url);
2671  return $this->_url;
2672  }
removeParameterFromQueryString($parameterName, $queryString)
Removes a parameter from a query string.
Definition: client.php:2685
traceEnd($res='')
This method is used to indicate the end of the execution of a function in debug mode.
Definition: CAS.php:604
traceBegin()
This method is used to indicate the start of the execution of a function in debug mode...
Definition: CAS.php:577
trace($str)
This method is used to log something in debug mode.
Definition: CAS.php:569
isHttps()
This method checks to see if the request is secured via HTTPS.
Definition: client.php:547
setURL($url)
This method sets the URL of the current request.
Definition: client.php:2699
$_url
the URL of the current request (without any ticket CGI parameter).
Definition: client.php:2611
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeParameterFromQueryString()

CASClient::removeParameterFromQueryString (   $parameterName,
  $queryString 
)

Removes a parameter from a query string.

Parameters
string$parameterName
string$queryString
Returns
string

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

Definition at line 2685 of file client.php.

Referenced by CASClient\getURL().

2686  {
2687  $parameterName = preg_quote($parameterName);
2688  return preg_replace("/&$parameterName(=[^&]*)?|^$parameterName(=[^&]*)?&?/", '', $queryString);
2689  }
+ Here is the caller graph for this function:

◆ setURL()

CASClient::setURL (   $url)
private

This method sets the URL of the current request.

Parameters
$urlurl to set for service

Definition at line 2699 of file client.php.

Referenced by CASClient\getURL().

2700  {
2701  $this->_url = $url;
2702  }
+ Here is the caller graph for this function:

Variable Documentation

◆ $_url

CASClient::$_url
private

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

Written and read by CASClient::getURL().

Definition at line 2611 of file client.php.

Referenced by CASClient\getURL().

◆ $GLOBALS [1/4]

$GLOBALS[ 'PHPCAS_CLIENT']

This global variable is used by the interface class phpCAS.

Definition at line 276 of file CAS.php.

◆ $GLOBALS [2/4]

$GLOBALS[ 'PHPCAS_INIT_CALL']

This global variable is used to store where the initializer is called from (to print a comprehensive error in case of multiple calls).

Definition at line 284 of file CAS.php.

◆ $GLOBALS [3/4]

$GLOBALS[ 'PHPCAS_AUTH_CHECK_CALL']

This global variable is used to store where the method checking the authentication is called from (to print comprehensive errors)

Definition at line 297 of file CAS.php.

◆ $GLOBALS [4/4]

$GLOBALS[ 'PHPCAS_DEBUG']

This global variable is used to store phpCAS debug mode.

Definition at line 310 of file CAS.php.

◆ $PHPCAS_AUTH_CHECK_CALL

$PHPCAS_AUTH_CHECK_CALL

This global variable is used to store where the method checking the authentication is called from (to print comprehensive errors)

Definition at line 195 of file CAS.php.

Referenced by phpCAS\checkAuthentication(), phpCAS\forceAuthentication(), phpCAS\getAttributes(), phpCAS\getUser(), phpCAS\isAuthenticated(), phpCAS\serviceMail(), phpCAS\serviceWeb(), phpCAS\setPGTStorageDB(), and phpCAS\setPGTStorageFile().

◆ $PHPCAS_CLIENT

◆ $PHPCAS_DEBUG

$PHPCAS_DEBUG

This global variable is used to store phpCAS debug mode.

Definition at line 206 of file CAS.php.

Referenced by phpCAS\log(), phpCAS\setDebug(), phpCAS\traceBegin(), phpCAS\traceEnd(), and phpCAS\traceExit().

◆ $PHPCAS_INIT_CALL

$PHPCAS_INIT_CALL

This global variable is used to store where the initializer is called from (to print a comprehensive error in case of multiple calls).

Definition at line 184 of file CAS.php.

Referenced by phpCAS\client(), and phpCAS\proxy().