Functions | Variables

InternalProxied

Functions

 CASClient::getPT ()
 This method returns the Proxy Ticket provided in the URL of the request.
 CASClient::setPT ($pt)
 This method stores the Proxy Ticket.
 CASClient::hasPT ()
 This method tells if a Proxy Ticket was stored.
 CASClient::validatePT (&$validate_url, &$text_response, &$tree_response)
 This method is used to validate a PT; halt on failure.

Variables

 CASClient::$_pt
 the Proxy Ticket provided in the URL of the request if present (empty otherwise).

Function Documentation

CASClient::getPT (  )  [private, inherited]

This method returns the Proxy Ticket provided in the URL of the request.

Returns:
The proxy ticket.

Definition at line 1697 of file client.php.

Referenced by CASClient::isAuthenticated().

    { return $this->_pt; }

Here is the caller graph for this function:

CASClient::hasPT (  )  [private, inherited]

This method tells if a Proxy Ticket was stored.

Returns:
TRUE if a Proxy Ticket has been stored.

Definition at line 1713 of file client.php.

    { return !empty($this->_pt); }

CASClient::setPT ( pt  )  [private, inherited]

This method stores the Proxy Ticket.

Parameters:
$pt The Proxy Ticket.

Definition at line 1705 of file client.php.

Referenced by CASClient::wasPreviouslyAuthenticated().

    { $this->_pt = $pt; }

Here is the caller graph for this function:

CASClient::validatePT ( &$  validate_url,
&$  text_response,
&$  tree_response 
) [private, inherited]

This method is used to validate a PT; halt on failure.

Returns:
bool TRUE when successfull, halt otherwise by calling CASClient::authError().

Definition at line 1732 of file client.php.

Referenced by CASClient::isAuthenticated().

    {
      phpCAS::traceBegin();
      // build the URL to validate the ticket
      $validate_url = $this->getServerProxyValidateURL().'&ticket='.$this->getPT();

      if ( $this->isProxy() ) {
      // pass the callback url for CAS proxies
        $validate_url .= '&pgtUrl='.$this->getCallbackURL();
      }

      // open and read the URL
      if ( !$this->readURL($validate_url,''/*cookies*/,$headers,$text_response,$err_msg) ) {
        phpCAS::trace('could not open URL \''.$validate_url.'\' to validate ('.$err_msg.')');
        $this->authError('PT not validated',
                         $validate_url,
                         TRUE/*$no_response*/);
      }

      // read the response of the CAS server into a DOM object
      if ( !($dom = domxml_open_mem($text_response))) {
        // read failed
        $this->authError('PT not validated',
                     $alidate_url,
                     FALSE/*$no_response*/,
                     TRUE/*$bad_response*/,
                     $text_response);
      }
      // read the root node of the XML tree
      if ( !($tree_response = $dom->document_element()) ) {
        // read failed
        $this->authError('PT not validated',
                     $validate_url,
                     FALSE/*$no_response*/,
                     TRUE/*$bad_response*/,
                     $text_response);
      }
      // insure that tag name is 'serviceResponse'
      if ( $tree_response->node_name(true) != 'serviceResponse' ) {
        // bad root node
        $this->authError('PT not validated',
                     $validate_url,
                     FALSE/*$no_response*/,
                     TRUE/*$bad_response*/,
                     $text_response);
      }
      if ( sizeof($arr = $tree_response->get_elements_by_tagname("authenticationSuccess")) != 0) {
        // authentication succeded, extract the user name
        if ( sizeof($arr = $tree_response->get_elements_by_tagname("user")) == 0) {
          // no user specified => error
          $this->authError('PT not validated',
                       $validate_url,
                       FALSE/*$no_response*/,
                       TRUE/*$bad_response*/,
                       $text_response);
        }
        $this->setUser(trim($arr[0]->get_content()));
        
      } else if ( sizeof($arr = $tree_response->get_elements_by_tagname("authenticationFailure")) != 0) {
        // authentication succeded, extract the error code and message
        $this->authError('PT not validated',
                     $validate_url,
                     FALSE/*$no_response*/,
                     FALSE/*$bad_response*/,
                     $text_response,
                     $arr[0]->get_attribute('code')/*$err_code*/,
                     trim($arr[0]->get_content())/*$err_msg*/);
      } else {
        $this->authError('PT not validated',
                     $validate_url,     
                     FALSE/*$no_response*/,
                     TRUE/*$bad_response*/,
                     $text_response);
      }
      
      // at this step, PT has been validated and $this->_user has been set,

      phpCAS::traceEnd(TRUE);
      return TRUE;
    }

Here is the caller graph for this function:


Variable Documentation

CASClient::$_pt [private, inherited]

the Proxy Ticket provided in the URL of the request if present (empty otherwise).

Written by CASClient::CASClient(), read by CASClient::getPT() and CASClient::hasPGT().

Definition at line 1690 of file client.php.