ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilBaseAuthentication Class Reference
+ Inheritance diagram for ilBaseAuthentication:
+ Collaboration 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 19 of file class.ilBaseAuthentication.php.

Member Function Documentation

ilBaseAuthentication::__buildAuth ( )

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

References getClient(), getPasswordType(), and IL_AUTH_MD5.

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

{
// BEGIN WebDAV
// The realm is needed to support a common session between Auth_HTTP and Auth.
// It also helps us to distinguish between parallel sessions run on different clients.
// Common session only works if we use a common session name starting with "_authhttp".
// We must use the "_authttp" prefix, because it is hardcoded in the session name of
// class Auth_HTTP.
// Note: The realm and sessionName used here, must be the same as in
// class ilAuthUtils. Otherwise, Soap clients won't be able to log
// in to ILIAS.
$realm = $this->getClient();
// END WebDAV
$this->auth_params = array(
'dsn' => $this->db->getDSN(),
'table' => $this->ini->readVariable("auth", "table"),
'usernamecol' => $this->ini->readVariable("auth", "usercol"),
'passwordcol' => $this->ini->readVariable("auth", "passcol"),
'sessionName' => "_authhttp".md5($realm)
);
if($this->getPasswordType() == IL_AUTH_MD5)
{
$this->auth_params['cryptType'] = 'none';
}
include_once './Services/Authentication/classes/class.ilAuthContainerDatabase.php';
$authContainerDB = new ilAuthContainerDatabase($this->auth_params);
$this->auth = new Auth($authContainerDB, $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 244 of file class.ilBaseAuthentication.php.

References __setMessage(), __setMessageCode(), getClient(), and ilDBWrapperFactory\getWrapper().

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();
include_once("./Services/Database/classes/class.ilDBWrapperFactory.php");
$this->db = ilDBWrapperFactory::getWrapper($this->ini->readVariable("db","type"));
$this->db->setDBUser($this->ini->readVariable("db", "user"));
$this->db->setDBPassword($this->ini->readVariable("db", "pass"));
$this->db->setDBName($this->ini->readVariable("db", "name"));
$this->db->setDBHost($this->ini->readVariable("db", "host"));
$this->dsn = $this->db->getDSN();
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilBaseAuthentication::__getAuthStatus ( )

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

References __setMessage(), __setMessageCode(), AUTH_EXPIRED, AUTH_IDLED, and AUTH_WRONG_LOGIN.

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

{
switch($this->auth->getStatus())
{
$this->__setMessageCode('Server');
$this->__setMessage('Session expired');
return false;
case AUTH_IDLED:
$this->__setMessageCode('Server');
$this->__setMessage('Session idled');
return false;
default:
$this->__setMessageCode('Client');
$this->__setMessage('Wrong Login or Password');
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)

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

Referenced by __buildDSN(), __getAuthStatus(), __setSessionSaveHandler(), ilSoapAuthentication\authenticate(), ilBaseAuthentication(), ilSoapAuthentication\ilSoapAuthentication(), and ilSoapAuthentication\validateSession().

{
$this->message_code = $a_message_code;
}

+ Here is the caller graph for this function:

ilBaseAuthentication::__setSessionSaveHandler ( )

Definition at line 309 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 "./Services/Utilities/classes/class.ilUtil.php";
include_once './classes/class.ilErrorHandling.php';
include_once './Services/Database/classes/class.ilDB.php';
$this->db->connect();
$GLOBALS['ilDB'] = $this->db;
if(ini_get('session.save_handler') != 'user')
{
ini_set("session.save_handler", "user");
}
{
$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 127 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;
}
{
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 69 of file class.ilBaseAuthentication.php.

References $client.

Referenced by __buildAuth(), __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 101 of file class.ilBaseAuthentication.php.

{
return $this->message;
}
ilBaseAuthentication::getMessageCode ( )

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

{
return $this->message_code;
}
ilBaseAuthentication::getPassword ( )

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

References $password.

{
}
ilBaseAuthentication::getPasswordType ( )

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

References IL_AUTH_PLAIN.

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 96 of file class.ilBaseAuthentication.php.

References $sid.

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

{
return $this->sid;
}

+ Here is the caller graph for this function:

ilBaseAuthentication::getUsername ( )

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

References $username.

Referenced by ilSoapAuthentication\__checkAgreement(), ilSoapAuthentication\authenticate(), and authenticate().

{
}

+ Here is the caller graph for this function:

ilBaseAuthentication::ilBaseAuthentication ( )

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

References __setMessage(), and __setMessageCode().

Referenced by 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 212 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 64 of file class.ilBaseAuthentication.php.

References $_COOKIE.

{
$this->client = $a_client;
$_COOKIE['ilClientId'] = $a_client;
}
ilBaseAuthentication::setPassword (   $a_password)

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

References $_POST.

{
$this->password = $a_password;
$_POST['password'] = $a_password;
}
ilBaseAuthentication::setPasswordType (   $a_type)

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

{
$this->password_type = $a_type;
}
ilBaseAuthentication::setSid (   $a_sid)

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

References $_COOKIE, and $sid.

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 73 of file class.ilBaseAuthentication.php.

References $_POST.

{
$this->username = $a_username;
$_POST['username'] = $a_username;
}
ilBaseAuthentication::start ( )

Definition at line 166 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 179 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;
}
{
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 26 of file class.ilBaseAuthentication.php.

ilBaseAuthentication::$client = ''

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

Referenced by getClient().

ilBaseAuthentication::$password = ''

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

Referenced by getPassword().

ilBaseAuthentication::$sid = ''

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

Referenced by getSid(), and setSid().

ilBaseAuthentication::$username = ''

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

Referenced by getUsername().


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