Functions | Variables

InternalConfig

Functions

 CASClient::getServerVersion ()
 This method is used to retrieve the version of the CAS server.
 CASClient::getServerHostname ()
 This method is used to retrieve the hostname of the CAS server.
 CASClient::getServerPort ()
 This method is used to retrieve the port of the CAS server.
 CASClient::getServerURI ()
 This method is used to retrieve the URI of the CAS server.
 CASClient::getServerBaseURL ()
 This method is used to retrieve the base URL of the CAS server.
 CASClient::getServerLoginURL ($gateway)
 This method is used to retrieve the login URL of the CAS server.
 CASClient::getServerServiceValidateURL ()
 This method is used to retrieve the service validating URL of the CAS server.
 CASClient::getServerProxyValidateURL ()
 This method is used to retrieve the proxy validating URL of the CAS server.
 CASClient::getServerProxyURL ()
 This method is used to retrieve the proxy URL of the CAS server.
 CASClient::getServerLogoutURL ()
 This method is used to retrieve the logout URL of the CAS server.
 CASClient::CASClient ($server_version, $proxy, $server_hostname, $server_port, $server_uri, $start_session=true)
 CASClient constructor.

Variables

 CASClient::$_server
 a record to store information about the CAS server.

Function Documentation

CASClient::CASClient ( server_version,
proxy,
server_hostname,
server_port,
server_uri,
start_session = true 
) [inherited]

CASClient constructor.

Parameters:
$server_version the version of the CAS server
$proxy TRUE if the CAS client is a CAS proxy, FALSE otherwise
$server_hostname the hostname of the CAS server
$server_port the port the CAS server is running on
$server_uri the URI the CAS server is responding on
$start_session Have phpCAS start PHP sessions (default true)
Returns:
a newly created CASClient object

Definition at line 435 of file client.php.

References $_GET, CASClient::isCallbackMode(), CASClient::isProxy(), and CASClient::setCallbackMode().

    {
      phpCAS::traceBegin();

      // activate session mechanism if desired
      if ($start_session) {
           session_start();
      }

      $this->_proxy = $proxy;

      // check version
      switch ($server_version) {
      case CAS_VERSION_1_0:
        if ( $this->isProxy() )
          phpCAS::error('CAS proxies are not supported in CAS '
                        .$server_version);
        break;
      case CAS_VERSION_2_0:
        break;
      default:
        phpCAS::error('this version of CAS (`'
                      .$server_version
                      .'\') is not supported by phpCAS '
                        .phpCAS::getVersion());
      }
      $this->_server['version'] = $server_version;

      // check hostname
      if ( empty($server_hostname) 
           || !preg_match('/[\.\d\-abcdefghijklmnopqrstuvwxyz]*/',$server_hostname) ) {
        phpCAS::error('bad CAS server hostname (`'.$server_hostname.'\')');
      }
      $this->_server['hostname'] = $server_hostname;

      // check port
      if ( $server_port == 0 
           || !is_int($server_port) ) {
        phpCAS::error('bad CAS server port (`'.$server_hostname.'\')');
      }
      $this->_server['port'] = $server_port;

      // check URI
      if ( !preg_match('/[\.\d\-_abcdefghijklmnopqrstuvwxyz\/]*/',$server_uri) ) {
        phpCAS::error('bad CAS server URI (`'.$server_uri.'\')');
      }
      // add leading and trailing `/' and remove doubles      
      $server_uri = preg_replace('/\/\//','/','/'.$server_uri.'/');
      $this->_server['uri'] = $server_uri;

      // set to callback mode if PgtIou and PgtId CGI GET parameters are provided 
      if ( $this->isProxy() ) {
        $this->setCallbackMode(!empty($_GET['pgtIou'])&&!empty($_GET['pgtId']));
      }

      if ( $this->isCallbackMode() ) {
        // callback mode: check that phpCAS is secured
        if ( $_SERVER['HTTPS'] != 'on' ) {
          phpCAS::error('CAS proxies must be secured to use phpCAS; PGT\'s will not be received from the CAS server');
        }
      } else {
        // normal mode: get ticket and remove it from CGI parameters for developpers
        $ticket = $_GET['ticket'];
        // at first check for a Service Ticket
        if( preg_match('/^ST-/',$ticket)) {
          phpCAS::trace('ST \''.$ticket.'\' found');
          // ST present
          $this->setST($ticket);
        } 
        // in a second time check for a Proxy Ticket (CAS >= 2.0)
        else if( ($this->getServerVersion()!=CAS_VERSION_1_0) && preg_match('/^PT-/',$ticket) ) {
          phpCAS::trace('PT \''.$ticket.'\' found');
          $this->setPT($ticket);
        } 
        // ill-formed ticket, halt
        else if ( !empty($ticket) ) {
          phpCAS::error('ill-formed ticket found in the URL (ticket=`'.htmlentities($ticket).'\')');
        }
        // ticket has been taken into account, unset it to hide it to applications
        unset($_GET['ticket']);
      }
      phpCAS::traceEnd();
    }

Here is the call graph for this function:

CASClient::getServerBaseURL (  )  [private, inherited]

This method is used to retrieve the base URL of the CAS server.

Returns:
a URL.

Definition at line 302 of file client.php.

Referenced by CASClient::getServerLoginURL(), CASClient::getServerLogoutURL(), CASClient::getServerProxyURL(), CASClient::getServerProxyValidateURL(), CASClient::getServerServiceValidateURL(), and CASClient::HTMLFilterOutput().

    { 
      // the URL is build only when needed
      if ( empty($this->_server['base_url']) ) {
                  
        // to do: undo this
        //$this->_server['base_url'] = 'https://'
        $this->_server['base_url'] = 'https://'
          .$this->getServerHostname()
          .':'
          .$this->getServerPort()
          .$this->getServerURI();
      }
//echo "-".$this->_server['base_url']."-";
      return $this->_server['base_url']; 
    }

Here is the caller graph for this function:

CASClient::getServerHostname (  )  [private, inherited]

This method is used to retrieve the hostname of the CAS server.

Returns:
the hostname of the CAS server.

Definition at line 278 of file client.php.

    { return $this->_server['hostname']; }

CASClient::getServerLoginURL ( gateway  )  [private, inherited]

This method is used to retrieve the login URL of the CAS server.

Parameters:
$gateway true to check authentication, false to force it
Returns:
a URL.

Definition at line 325 of file client.php.

References CASClient::getServerBaseURL(), and CASClient::getURL().

Referenced by CASClient::redirectToCas().

    { 
      phpCAS::traceBegin();
      // the URL is build only when needed
      if ( empty($this->_server['login_url']) ) {
        $this->_server['login_url'] = $this->getServerBaseURL();
        $this->_server['login_url'] .= 'login?service=';
        $this->_server['login_url'] .= preg_replace('/&/','%26',$this->getURL());
        if ($gateway) {
          $this->_server['login_url'] .= '&gateway=true';
        }
      }
      phpCAS::traceEnd($this->_server['login_url']);
      return $this->_server['login_url']; 
    }

Here is the call graph for this function:

Here is the caller graph for this function:

CASClient::getServerLogoutURL (  )  [private, inherited]

This method is used to retrieve the logout URL of the CAS server.

Returns:
a URL.

Definition at line 409 of file client.php.

References CASClient::getServerBaseURL().

Referenced by CASClient::logout().

    { 
      // the URL is build only when needed
      if ( empty($this->_server['logout_url']) ) {
        $this->_server['logout_url'] = $this->getServerBaseURL().'logout';
      }
      return $this->_server['logout_url']; 
    }

Here is the call graph for this function:

Here is the caller graph for this function:

CASClient::getServerPort (  )  [private, inherited]

This method is used to retrieve the port of the CAS server.

Returns:
the port of the CAS server.

Definition at line 286 of file client.php.

    { return $this->_server['port']; }

CASClient::getServerProxyURL (  )  [private, inherited]

This method is used to retrieve the proxy URL of the CAS server.

Returns:
a URL.

Definition at line 388 of file client.php.

References CASClient::getServerBaseURL(), and CASClient::getServerVersion().

    { 
      // the URL is build only when needed
      if ( empty($this->_server['proxy_url']) ) {
        switch ($this->getServerVersion()) {
        case CAS_VERSION_1_0:
          $this->_server['proxy_url'] = '';
          break;
        case CAS_VERSION_2_0:
          $this->_server['proxy_url'] = $this->getServerBaseURL().'proxy';
          break;
        }
      }
      return $this->_server['proxy_url']; 
    }

Here is the call graph for this function:

CASClient::getServerProxyValidateURL (  )  [private, inherited]

This method is used to retrieve the proxy validating URL of the CAS server.

Returns:
a URL.

Definition at line 367 of file client.php.

References CASClient::getServerBaseURL(), CASClient::getServerVersion(), and CASClient::getURL().

    { 
      // the URL is build only when needed
      if ( empty($this->_server['proxy_validate_url']) ) {
        switch ($this->getServerVersion()) {
        case CAS_VERSION_1_0:
          $this->_server['proxy_validate_url'] = '';
          break;
        case CAS_VERSION_2_0:
          $this->_server['proxy_validate_url'] = $this->getServerBaseURL().'proxyValidate';
          break;
        }
      }
      return $this->_server['proxy_validate_url'].'?service='.preg_replace('/&/','%26',$this->getURL()); 
    }

Here is the call graph for this function:

CASClient::getServerServiceValidateURL (  )  [private, inherited]

This method is used to retrieve the service validating URL of the CAS server.

Returns:
a URL.

Definition at line 346 of file client.php.

References CASClient::getServerBaseURL(), CASClient::getServerVersion(), and CASClient::getURL().

Referenced by CASClient::validateST().

    { 
      // the URL is build only when needed
      if ( empty($this->_server['service_validate_url']) ) {
        switch ($this->getServerVersion()) {
        case CAS_VERSION_1_0:
          $this->_server['service_validate_url'] = $this->getServerBaseURL().'validate';
          break;
        case CAS_VERSION_2_0:
          $this->_server['service_validate_url'] = $this->getServerBaseURL().'serviceValidate';
          break;
        }
      }
      return $this->_server['service_validate_url'].'?service='.preg_replace('/&/','%26',$this->getURL()); 
    }

Here is the call graph for this function:

Here is the caller graph for this function:

CASClient::getServerURI (  )  [private, inherited]

This method is used to retrieve the URI of the CAS server.

Returns:
a URI.

Definition at line 294 of file client.php.

    { return $this->_server['uri']; }

CASClient::getServerVersion (  )  [private, inherited]

This method is used to retrieve the version of the CAS server.

Returns:
the version of the CAS server.

Definition at line 268 of file client.php.

Referenced by CASClient::getServerProxyURL(), CASClient::getServerProxyValidateURL(), CASClient::getServerServiceValidateURL(), and CASClient::HTMLFilterOutput().

    { 
      return $this->_server['version']; 
    }

Here is the caller graph for this function:


Variable Documentation

CASClient::$_server [private, inherited]

a record to store information about the CAS server.

  • $_server["version"]: the version of the CAS server
  • $_server["hostname"]: the hostname of the CAS server
  • $_server["port"]: the port the CAS server is running on
  • $_server["uri"]: the base URI the CAS server is responding on
  • $_server["base_url"]: the base URL of the CAS server
  • $_server["login_url"]: the login URL of the CAS server
  • $_server["service_validate_url"]: the service validating URL of the CAS server
  • $_server["proxy_url"]: the proxy URL of the CAS server
  • $_server["proxy_validate_url"]: the proxy validating URL of the CAS server
  • $_server["logout_url"]: the logout URL of the CAS server

$_server["version"], $_server["hostname"], $_server["port"] and $_server["uri"] are written by CASClient::CASClient(), read by CASClient::getServerVersion(), CASClient::getServerHostname(), CASClient::getServerPort() and CASClient::getServerURI().

The other fields are written and read by CASClient::getServerBaseURL(), CASClient::getServerLoginURL(), CASClient::getServerServiceValidateURL(), CASClient::getServerProxyValidateURL() and CASClient::getServerLogoutURL().

Definition at line 256 of file client.php.