Public Member Functions

ilSoapAuthenticationCAS Class Reference

Inheritance diagram for ilSoapAuthenticationCAS:
Collaboration diagram for ilSoapAuthenticationCAS:

Public Member Functions

 ilSoapAuthenticationCAS ()
 setPT ($a_pt)
 getPT ()
 authenticate ()
 validateSession ()
 __buildAuth ()

Detailed Description

Definition at line 36 of file class.ilSoapAuthenticationCAS.php.


Member Function Documentation

ilSoapAuthenticationCAS::__buildAuth (  ) 

Definition at line 227 of file class.ilSoapAuthenticationCAS.php.

References $query, and $res.

Referenced by authenticate(), and validateSession().

        {

                if (!is_object($this->db))
                {
                        include_once './classes/class.ilDBx.php';
                        $this->db =& new ilDBx($this->dsn);
                }

                $query = "SELECT * FROM settings WHERE ".
                        " keyword = ".$this->db->quote("cas_server")." OR ".
                        " keyword = ".$this->db->quote("cas_port")." OR ".
                        " keyword = ".$this->db->quote("cas_uri");
                $res = $this->db->query($query);
                $cas_set = array();
                while ($rec = $res->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        $cas_set[$rec["keyword"]] = $rec["value"];
                }

                $auth_params = array(
                        "server_version" => CAS_VERSION_2_0,
                        "server_hostname" => $cas_set["cas_server"],
                        "server_port" => $cas_set["cas_port"],
                        "server_uri" => $cas_set["cas_uri"]);

                include_once("Services/CAS/classes/class.ilCASAuth.php");
                $this->auth = new ilCASAuth($auth_params);
                
                // HTTP path will return full path to server.php directory
                phpCAS::setFixedServiceURL(ILIAS_HTTP_PATH."/server.php");

                return true;
        }

Here is the caller graph for this function:

ilSoapAuthenticationCAS::authenticate (  ) 

Definition at line 89 of file class.ilSoapAuthenticationCAS.php.

References __buildAuth(), and ilObjUser::_checkExternalAuthAccount().

        {
                include_once("./Services/Init/classes/class.ilInitialisation.php");
                $init = new ilInitialisation();
                $init->requireCommonIncludes();
                $init->buildHTTPPath();
                
                if(!$this->getClient())
                {
                        $this->__setMessage('No client given');
                        return false;
                }
                if(!$this->getUsername())
                {
                        $this->__setMessage('No username given');
                        return false;
                }
                // Read ilias ini
                if(!$this->__buildDSN())
                {
                        $this->__setMessage('Error building dsn/Wrong client Id?');
                        return false;
                }
                if(!$this->__setSessionSaveHandler())
                {
                        return false;
                }

                if(!$this->__buildAuth())
                {
                        return false;
                }
                if($this->soap_check and !$this->__checkSOAPEnabled())
                {
                        $this->__setMessage('SOAP is not enabled in ILIAS administration for this client');
                        $this->__setMessageCode('Server');

                        return false;
                }

                // check whether authentication is valid
                //if (!$this->auth->checkCASAuth())
                if (!phpCAS::checkAuthentication())
                {
                        $this->__setMessage('ilSOAPAuthenticationCAS::authenticate(): No valid CAS authentication.');
                        return false;
                }
                $this->auth->forceCASAuth();

                if ($this->getUsername() != $this->auth->getCASUser())
                {
                        $this->__setMessage('ilSOAPAuthenticationCAS::authenticate(): SOAP CAS user does not match to ticket user.');
                        return false;
                }

                include_once("classes/class.ilObjUser.php");
                $local_user = ilObjUser::_checkExternalAuthAccount("cas", $this->auth->getCASUser());
                if ($local_user == "")
                {
                        $this->__setMessage('ilSOAPAuthenticationCAS::authenticate(): SOAP CAS user authenticated but not existing in ILIAS user database.');
                        return false;
                }

                                
                /*
                $init->initIliasIniFile();
                $init->initSettings();
                $ilias =& new ILIAS();
                $GLOBALS['ilias'] =& $ilias;*/

                $this->auth->start();
//echo "5";
                if(!$this->auth->getAuth())
                {
                        $this->__getAuthStatus();

                        return false;
                }

                $this->setSid(session_id());

                return true;
        }

Here is the call graph for this function:

ilSoapAuthenticationCAS::getPT (  ) 

Definition at line 84 of file class.ilSoapAuthenticationCAS.php.

        {
                return $this->pt;
        }

ilSoapAuthenticationCAS::ilSoapAuthenticationCAS (  ) 

Definition at line 38 of file class.ilSoapAuthenticationCAS.php.

        {
                parent::ilSOAPAuthentication();
        }

ilSoapAuthenticationCAS::setPT ( a_pt  ) 

Definition at line 79 of file class.ilSoapAuthenticationCAS.php.

References $_GET.

        {
                $this->pt = $a_pt;
                $_GET['ticket'] = $a_pt;
        }

ilSoapAuthenticationCAS::validateSession (  ) 

Definition at line 174 of file class.ilSoapAuthenticationCAS.php.

References __buildAuth().

        {
                if(!$this->getClient())
                {
                        $this->__setMessage('No client given');
                        return false;
                }
                if(!$this->getSid())
                {
                        $this->__setMessage('No session id given');
                        return false;
                }

                if(!$this->__buildDSN())
                {
                        $this->__setMessage('Error building dsn');
                        return false;
                }
                if(!$this->__setSessionSaveHandler())
                {
                        return false;
                }
                if(!$this->__buildAuth())
                {
                        return false;
                }
                if($this->soap_check and !$this->__checkSOAPEnabled())
                {
                        $this->__setMessage('SOAP is not enabled in ILIAS administration for this client');
                        $this->__setMessageCode('Server');

                        return false;
                }
                
                // check whether authentication is valid
                if (!$this->auth->checkCASAuth())
                {
                        $this->__setMessage('ilSOAPAuthenticationCAS::authenticate(): No valid CAS authentication.');
                        return false;
                }
                $this->auth->forceCASAuth();

                $this->auth->start();
                if(!$this->auth->getAuth())
                {
                        $this->__setMessage('Session not valid');

                        return false;
                }

                return true;
        }

Here is the call graph for this function:


The documentation for this class was generated from the following file: