Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

ilAuthRadius Class Reference
[ServicesRadius]

Auth Radius overwrites PEAR Auth to perform Radius authentication with specific ILIAS options. More...

Inheritance diagram for ilAuthRadius:
Collaboration diagram for ilAuthRadius:

Public Member Functions

 __construct ()
 forceCreation ($a_status)
 Force creation of user accounts.

Protected Member Functions

 loginObserver ($a_username)
 Called from base class after successful login.
 failedLoginObserver ()
 Called from base class after failed login.

Private Member Functions

 initSettings ()
 initAttributeToUser ()
 setCallbacks ()
 Set callback function for PEAR Auth.

Private Attributes

 $radius_settings = null
 $rad_to_user = null
 $log = null
 $force_creation = false

Detailed Description

Auth Radius overwrites PEAR Auth to perform Radius authentication with specific ILIAS options.

Author:
Stefan Meyer <smeyer@databay.de>
Version:
$Id$

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


Constructor & Destructor Documentation

ilAuthRadius::__construct (  ) 

Definition at line 44 of file class.ilAuthRadius.php.

References $ilLog, initSettings(), ilRadiusSettings::RADIUS_CHARSET_LATIN1, and setCallbacks().

        {
                global $ilLog;
                
                $this->log = $ilLog;
                
                // Read setting of LDAP server
                $this->initSettings();
                
                // Convert password to latin1
                if($this->radius_settings->getCharset() == ilRadiusSettings::RADIUS_CHARSET_LATIN1)
                {
                        #$_POST['username'] = utf8_decode($_POST['username']);
                        $_POST['password'] = utf8_decode($_POST['password']);
                        $this->log->write(__METHOD__.': Decoded username and password to latin1.');
                }
                
                
                parent::Auth('RADIUS',$this->radius_settings->toPearAuthArray(),'',false);
                
                // Set callbacks
                $this->setCallbacks();
        }

Here is the call graph for this function:


Member Function Documentation

ilAuthRadius::failedLoginObserver (  )  [protected]

Called from base class after failed login.

Parameters:
string username

Definition at line 132 of file class.ilAuthRadius.php.

        {
                #$this->log->write($this->logCache);
                $this->logCache = '';
        }

ilAuthRadius::forceCreation ( a_status  ) 

Force creation of user accounts.

public

Parameters:
bool force_creation

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

        {
                $this->force_creation = true;
        }

ilAuthRadius::initAttributeToUser (  )  [private]

Definition at line 145 of file class.ilAuthRadius.php.

Referenced by loginObserver().

        {
                include_once('Services/Radius/classes/class.ilRadiusAttributeToUser.php');
                $this->radius_user = new ilRadiusAttributeToUser();
        }

Here is the caller graph for this function:

ilAuthRadius::initSettings (  )  [private]

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

References ilRadiusSettings::_getInstance().

Referenced by __construct().

        {
                include_once 'Services/Radius/classes/class.ilRadiusSettings.php';
                $this->radius_settings = ilRadiusSettings::_getInstance();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilAuthRadius::loginObserver ( a_username  )  [protected]

Called from base class after successful login.

Parameters:
string username

Definition at line 86 of file class.ilAuthRadius.php.

References $_SESSION, ilObjUser::_checkExternalAuthAccount(), initAttributeToUser(), logout(), and ilUtil::redirect().

        {
                $user_data = array_change_key_case($this->getAuthData(),CASE_LOWER);
                
                $user_data['ilInternalAccount'] = ilObjUser::_checkExternalAuthAccount("radius",$a_username);
                
                if(!$user_data['ilInternalAccount'])
                {
                        if($this->radius_settings->enabledCreation())
                        {
                                if($this->radius_settings->isAccountMigrationEnabled() and !$this->force_creation)
                                {
                                        $this->logout();
                                        $_SESSION['tmp_auth_mode'] = 'radius';
                                        $_SESSION['tmp_external_account'] = $a_username;
                                        $_SESSION['tmp_pass'] = $_POST['password'];
                                        $_SESSION['tmp_roles'] = array(0 => $this->radius_settings->getDefaultRole());
                                
                                        ilUtil::redirect('ilias.php?baseClass=ilStartUpGUI&cmd=showAccountMigration');
                                }
                                $this->initAttributeToUser();
                                $new_name = $this->radius_user->create($a_username);
                                $this->setAuth($new_name);
                                return true;
                        }
                        else
                        {
                                // No syncronisation allowed => create Error
                                $this->status = AUTH_RADIUS_NO_ILIAS_USER;
                                $this->logout();
                                return false;
                        }
                        
                }
                else
                {
                        $this->setAuth($user_data['ilInternalAccount']);
                        return true;
                }
        }

Here is the call graph for this function:

ilAuthRadius::setCallbacks (  )  [private]

Set callback function for PEAR Auth.

Definition at line 155 of file class.ilAuthRadius.php.

Referenced by __construct().

        {
                $this->setLoginCallback(array($this,'loginObserver'));
                $this->setFailedLoginCallback(array($this,'failedLoginObserver'));
        }

Here is the caller graph for this function:


Field Documentation

ilAuthRadius::$force_creation = false [private]

Definition at line 42 of file class.ilAuthRadius.php.

ilAuthRadius::$log = null [private]

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

ilAuthRadius::$rad_to_user = null [private]

Definition at line 39 of file class.ilAuthRadius.php.

ilAuthRadius::$radius_settings = null [private]

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


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