Public Member Functions | Data Fields

ilSoapAuthentication Class Reference

Public Member Functions

 ilSoapAuthentication ()
 setClient ($a_client)
 getClient ()
 setUsername ($a_username)
 getUsername ()
 setPassword ($a_password)
 getPassword ()
 setSid ($a_sid)
 getSid ()
 getMessage ()
 getMessageCode ()
 __setMessage ($a_message)
 __setMessageCode ($a_message_code)
 authenticate ()
 start ()
 validateSession ()
 logout ()
 __checkSOAPEnabled ()
 __buildAuth ()
 __setSessionSaveHandler ()
 __getAuthStatus ()

Data Fields

 $sid = ''
 $username = ''
 $password = ''
 $client = ''

Detailed Description

Definition at line 35 of file class.ilSoapAuthentication.php.


Member Function Documentation

ilSoapAuthentication::__buildAuth (  ) 

Definition at line 265 of file class.ilSoapAuthentication.php.

References __setMessage(), __setMessageCode(), and getClient().

Referenced by authenticate(), logout(), and validateSession().

        {
                include_once './classes/class.ilIniFile.php';

                // get ilias ini file
                $this->ilias_ini =& new ilIniFile('./ilias.ini.php');
                $this->ilias_ini->read();

                if(!@file_exists("./".$this->ilias_ini->readVariable('clients','path')."/".$this->getClient()."/client.ini.php"))
                {
                        $this->__setMessageCode('Client');
                        $this->__setMessage('Client does not exist');

                        return false;
                }
                
                $this->ini =& new ilIniFile("./".$this->ilias_ini->readVariable('clients','path')."/".$this->getClient()."/client.ini.php");
                $this->ini->read();
                
                $this->dsn = $this->ini->readVariable("db","type").
                                         "://".$this->ini->readVariable("db", "user").
                                         ":".$this->ini->readVariable("db", "pass").
                                         "@".$this->ini->readVariable("db", "host").
                                         "/".$this->ini->readVariable("db", "name");


                $this->auth_params = array(
                        'dsn'             => $this->dsn,
                        'table'       => $this->ini->readVariable("auth", "table"),
                        'usernamecol' => $this->ini->readVariable("auth", "usercol"),
                        'passwordcol' => $this->ini->readVariable("auth", "passcol")
                        );

                $this->auth = new Auth("DB", $this->auth_params,"",false);

                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilSoapAuthentication::__checkSOAPEnabled (  ) 

Definition at line 250 of file class.ilSoapAuthentication.php.

References $query, and $res.

Referenced by authenticate(), and validateSession().

        {
                include_once './classes/class.ilDBx.php';

                
                $db =& new ilDBx($this->dsn);

                $query = "SELECT * FROM settings WHERE keyword = 'soap_user_administration' AND value = 1";

                $res = $db->query($query);

                return $res->numRows() ? true : false;
        }

Here is the caller graph for this function:

ilSoapAuthentication::__getAuthStatus (  ) 

Definition at line 328 of file class.ilSoapAuthentication.php.

References __setMessage(), and __setMessageCode().

Referenced by authenticate().

        {
                switch($this->auth->getStatus())
                {
                        case AUTH_EXPIRED:
                                $this->__setMessageCode('Server');
                                $this->__setMessage('Session expired');

                                return false;

                        case AUTH_IDLED:
                                $this->__setMessageCode('Server');
                                $this->__setMessage('Session idled');
                                
                                return false;
                                
                        case AUTH_WRONG_LOGIN:
                        default:
                                $this->__setMessageCode('Client');
                                $this->__setMessage('Wrong login');

                                return false;
                                
                                
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilSoapAuthentication::__setMessage ( a_message  ) 

Definition at line 115 of file class.ilSoapAuthentication.php.

Referenced by __buildAuth(), __getAuthStatus(), __setSessionSaveHandler(), authenticate(), ilSoapAuthentication(), logout(), start(), and validateSession().

        {
                $this->message = $a_message;
        }

Here is the caller graph for this function:

ilSoapAuthentication::__setMessageCode ( a_message_code  ) 

Definition at line 119 of file class.ilSoapAuthentication.php.

Referenced by __buildAuth(), __getAuthStatus(), __setSessionSaveHandler(), authenticate(), ilSoapAuthentication(), and validateSession().

        {
                $this->message_code = $a_message_code;
        }

Here is the caller graph for this function:

ilSoapAuthentication::__setSessionSaveHandler (  ) 

Definition at line 303 of file class.ilSoapAuthentication.php.

References $GLOBALS, __setMessage(), __setMessageCode(), and db_set_save_handler().

Referenced by authenticate(), logout(), and validateSession().

        {
                include_once './include/inc.db_session_handler.php';
                include_once './classes/class.ilUtil.php';
                include_once './classes/class.ilErrorHandling.php';
                include_once './classes/class.ilDBx.php';

                
                $GLOBALS['ilDB'] =& new ilDBx($this->dsn);

                if(ini_get('session.save_handler') != 'user')
                {
                        ini_set("session.save_handler", "user");
                }
                if(!db_set_save_handler())
                {
                        $this->__setMessageCode('Server');
                        $this->__setMessage('Cannot set session handler');

                        return false;
                }

                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilSoapAuthentication::authenticate (  ) 

Definition at line 124 of file class.ilSoapAuthentication.php.

References __buildAuth(), __checkSOAPEnabled(), __getAuthStatus(), __setMessage(), __setMessageCode(), __setSessionSaveHandler(), getClient(), getUsername(), and setSid().

        {
                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->__buildAuth())
                {
                        return false;
                }
                if(!$this->__setSessionSaveHandler())
                {
                        return false;
                }
                if(!$this->__checkSOAPEnabled())
                {
                        $this->__setMessage('SOAP is not enabled in ILIAS administration for this client');
                        $this->__setMessageCode('Server');

                        return false;
                }


                $this->auth->start();

                if(!$this->auth->getAuth())
                {
                        $this->__getAuthStatus();

                        return false;
                }                       

                $this->setSid(session_id());

                return true;
        }

Here is the call graph for this function:

ilSoapAuthentication::getClient (  ) 

Definition at line 75 of file class.ilSoapAuthentication.php.

Referenced by __buildAuth(), authenticate(), logout(), and validateSession().

        {
                return $this->client;
        }

Here is the caller graph for this function:

ilSoapAuthentication::getMessage (  ) 

Definition at line 107 of file class.ilSoapAuthentication.php.

        {
                return $this->message;
        }

ilSoapAuthentication::getMessageCode (  ) 

Definition at line 111 of file class.ilSoapAuthentication.php.

        {
                return $this->message_code;
        }

ilSoapAuthentication::getPassword (  ) 

Definition at line 93 of file class.ilSoapAuthentication.php.

        {
                return $this->password;
        }

ilSoapAuthentication::getSid (  ) 

Definition at line 102 of file class.ilSoapAuthentication.php.

Referenced by logout(), start(), and validateSession().

        {
                return $this->sid;
        }

Here is the caller graph for this function:

ilSoapAuthentication::getUsername (  ) 

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

Referenced by authenticate().

        {
                return $this->username;
        }

Here is the caller graph for this function:

ilSoapAuthentication::ilSoapAuthentication (  ) 

Definition at line 62 of file class.ilSoapAuthentication.php.

References __setMessage(), and __setMessageCode().

        {
                $this->__setMessage('');
                $this->__setMessageCode('Client');
        }

Here is the call graph for this function:

ilSoapAuthentication::logout (  ) 

Definition at line 220 of file class.ilSoapAuthentication.php.

References __buildAuth(), __setMessage(), __setSessionSaveHandler(), getClient(), and getSid().

        {
                if(!$this->getClient())
                {
                        $this->__setMessage('No client given');
                        return false;
                }
                if(!$this->getSid())
                {
                        $this->__setMessage('No session id given');
                        return false;
                }
                if(!$this->__buildAuth())
                {
                        return false;
                }
                if(!$this->__setSessionSaveHandler())
                {
                        return false;
                }
                
                // And finally logout
                $this->auth->start();
                $this->auth->logout();
                session_destroy();

                return true;

        }

Here is the call graph for this function:

ilSoapAuthentication::setClient ( a_client  ) 

Definition at line 70 of file class.ilSoapAuthentication.php.

References $_COOKIE.

        {
                $this->client = $a_client;
                $_COOKIE['ilClientId'] = $a_client;
        }

ilSoapAuthentication::setPassword ( a_password  ) 

Definition at line 88 of file class.ilSoapAuthentication.php.

References $_POST.

        {
                $this->password = $a_password;
                $_POST['password'] = $a_password;
        }

ilSoapAuthentication::setSid ( a_sid  ) 

Definition at line 97 of file class.ilSoapAuthentication.php.

References $_COOKIE.

Referenced by authenticate().

        {
                $this->sid = $a_sid;
                $_COOKIE['PHPSESSID'] = $this->sid;
        }

Here is the caller graph for this function:

ilSoapAuthentication::setUsername ( a_username  ) 

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

References $_POST.

        {
                $this->username = $a_username;
                $_POST['username'] = $a_username;
        }

ilSoapAuthentication::start (  ) 

Definition at line 168 of file class.ilSoapAuthentication.php.

References __setMessage(), and getSid().

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

                $this->auth->start();

                return true;
        }

Here is the call graph for this function:

ilSoapAuthentication::validateSession (  ) 

Definition at line 181 of file class.ilSoapAuthentication.php.

References __buildAuth(), __checkSOAPEnabled(), __setMessage(), __setMessageCode(), __setSessionSaveHandler(), getClient(), and getSid().

        {
                if(!$this->getClient())
                {
                        $this->__setMessage('No client given');
                        return false;
                }
                if(!$this->getSid())
                {
                        $this->__setMessage('No session id given');
                        return false;
                }
                
                if(!$this->__buildAuth())
                {
                        return false;
                }
                if(!$this->__setSessionSaveHandler())
                {
                        return false;
                }
                if(!$this->__checkSOAPEnabled())
                {
                        $this->__setMessage('SOAP is not enabled in ILIAS administration for this client');
                        $this->__setMessageCode('Server');

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

Here is the call graph for this function:


Field Documentation

ilSoapAuthentication::$client = ''

Definition at line 60 of file class.ilSoapAuthentication.php.

ilSoapAuthentication::$password = ''

Definition at line 53 of file class.ilSoapAuthentication.php.

ilSoapAuthentication::$sid = ''

Definition at line 41 of file class.ilSoapAuthentication.php.

ilSoapAuthentication::$username = ''

Definition at line 47 of file class.ilSoapAuthentication.php.


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