Public Member Functions | Data Fields

ilBaseAuthentication Class Reference

Inheritance diagram for ilBaseAuthentication:

Public Member Functions

 ilBaseAuthentication ()
 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)
 setPasswordType ($a_type)
 getPasswordType ()
 authenticate ()
 start ()
 validateSession ()
 logout ()
 __buildDSN ()
 __buildAuth ()
 __setSessionSaveHandler ()
 __getAuthStatus ()

Data Fields

 $auth = null
 $sid = ''
 $username = ''
 $password = ''
 $client = ''

Detailed Description

Definition at line 40 of file class.ilBaseAuthentication.php.


Member Function Documentation

ilBaseAuthentication::__buildAuth (  ) 

Definition at line 293 of file class.ilBaseAuthentication.php.

References getPasswordType().

Referenced by ilSoapAuthentication::authenticate(), authenticate(), ilSoapAuthentication::validateSession(), and validateSession().

        {
                $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")
                        );

                if($this->getPasswordType() == IL_AUTH_MD5)
                {
                        $this->auth_params['cryptType'] = 'none';
                }

                $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:

ilBaseAuthentication::__buildDSN (  ) 

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

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

Referenced by ilSoapAuthentication::authenticate(), authenticate(), and ilSoapAuthentication::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");

                return true;
        }               

Here is the call graph for this function:

Here is the caller graph for this function:

ilBaseAuthentication::__getAuthStatus (  ) 

Definition at line 337 of file class.ilBaseAuthentication.php.

References __setMessage(), and __setMessageCode().

Referenced by ilSoapAuthentication::authenticate(), and 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:

ilBaseAuthentication::__setMessage ( a_message  ) 
ilBaseAuthentication::__setMessageCode ( a_message_code  ) 
ilBaseAuthentication::__setSessionSaveHandler (  ) 

Definition at line 312 of file class.ilBaseAuthentication.php.

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

Referenced by ilSoapAuthentication::authenticate(), authenticate(), ilSoapAuthentication::validateSession(), 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:

ilBaseAuthentication::authenticate (  ) 

Reimplemented in ilSoapAuthentication.

Definition at line 148 of file class.ilBaseAuthentication.php.

References __buildAuth(), __buildDSN(), __getAuthStatus(), __setMessage(), __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->__buildDSN())
                {
                        return false;
                }
                if(!$this->__setSessionSaveHandler())
                {
                        return false;
                }
                if(!$this->__buildAuth())
                {
                        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:

ilBaseAuthentication::getClient (  ) 

Definition at line 90 of file class.ilBaseAuthentication.php.

Referenced by __buildDSN(), ilSoapAuthentication::authenticate(), authenticate(), logout(), ilSoapAuthentication::validateSession(), and validateSession().

        {
                return $this->client;
        }

Here is the caller graph for this function:

ilBaseAuthentication::getMessage (  ) 

Definition at line 122 of file class.ilBaseAuthentication.php.

        {
                return $this->message;
        }

ilBaseAuthentication::getMessageCode (  ) 

Definition at line 126 of file class.ilBaseAuthentication.php.

        {
                return $this->message_code;
        }

ilBaseAuthentication::getPassword (  ) 

Definition at line 108 of file class.ilBaseAuthentication.php.

        {
                return $this->password;
        }

ilBaseAuthentication::getPasswordType (  ) 

Definition at line 143 of file class.ilBaseAuthentication.php.

Referenced by __buildAuth().

        {
                return isset($this->password_type) ? $this->password_type : IL_AUTH_PLAIN;
        }

Here is the caller graph for this function:

ilBaseAuthentication::getSid (  ) 

Definition at line 117 of file class.ilBaseAuthentication.php.

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

        {
                return $this->sid;
        }

Here is the caller graph for this function:

ilBaseAuthentication::getUsername (  ) 

Definition at line 99 of file class.ilBaseAuthentication.php.

Referenced by ilSoapAuthentication::authenticate(), and authenticate().

        {
                return $this->username;
        }

Here is the caller graph for this function:

ilBaseAuthentication::ilBaseAuthentication (  ) 

Definition at line 76 of file class.ilBaseAuthentication.php.

References __setMessage(), and __setMessageCode().

Referenced by ilCronAuthentication::ilCronAuthentication(), ilRADIUSAuthentication::ilRADIUSAuthentication(), and ilSoapAuthentication::ilSoapAuthentication().

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

Here is the call graph for this function:

Here is the caller graph for this function:

ilBaseAuthentication::logout (  ) 

Definition at line 233 of file class.ilBaseAuthentication.php.

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

        {
                if(!$this->getClient())
                {
                        $this->__setMessage('No client given');
                        return false;
                }
                if(!$this->getSid())
                {
                        $this->__setMessage('No session id given');
                        return false;
                }
                // logged auth users are authenticated
                // No preperations are required
                #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:

ilBaseAuthentication::setClient ( a_client  ) 

Definition at line 85 of file class.ilBaseAuthentication.php.

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

ilBaseAuthentication::setPassword ( a_password  ) 

Definition at line 103 of file class.ilBaseAuthentication.php.

References $_POST.

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

ilBaseAuthentication::setPasswordType ( a_type  ) 

Definition at line 139 of file class.ilBaseAuthentication.php.

        {
                $this->password_type = $a_type;
        }

ilBaseAuthentication::setSid ( a_sid  ) 

Definition at line 112 of file class.ilBaseAuthentication.php.

Referenced by ilSoapAuthentication::authenticate(), and authenticate().

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

Here is the caller graph for this function:

ilBaseAuthentication::setUsername ( a_username  ) 

Definition at line 94 of file class.ilBaseAuthentication.php.

References $_POST.

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

ilBaseAuthentication::start (  ) 

Definition at line 187 of file class.ilBaseAuthentication.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:

ilBaseAuthentication::validateSession (  ) 

Reimplemented in ilSoapAuthentication.

Definition at line 200 of file class.ilBaseAuthentication.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;
                }

                $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

ilBaseAuthentication::$auth = null

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

ilBaseAuthentication::$client = ''

Definition at line 74 of file class.ilBaseAuthentication.php.

ilBaseAuthentication::$password = ''

Definition at line 67 of file class.ilBaseAuthentication.php.

ilBaseAuthentication::$sid = ''

Definition at line 55 of file class.ilBaseAuthentication.php.

ilBaseAuthentication::$username = ''

Definition at line 61 of file class.ilBaseAuthentication.php.


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