ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilAuthRadius Class Reference

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 ($a_options)
 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 smeye.nosp@m.r@da.nosp@m.tabay.nosp@m..de
Version
$Id$

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

Constructor & Destructor Documentation

ilAuthRadius::__construct (   $a_options)

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.');
}
if(is_array($a_options))
{
$options = array_merge($this->radius_settings->toPearAuthArray(),$a_options);
}
else
{
$options = $this->radius_settings->toPearAuthArray();
}
parent::Auth('RADIUS',$options,'',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
stringusername

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

{
#$this->log->write($this->logCache);
$this->logCache = '';
}
ilAuthRadius::forceCreation (   $a_status)

Force creation of user accounts.

public

Parameters
boolforce_creation

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

{
$this->force_creation = true;
}
ilAuthRadius::initAttributeToUser ( )
private

Definition at line 153 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 147 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
stringusername

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

References $_SESSION, $force_creation, ilObjUser\_checkExternalAuthAccount(), AUTH_RADIUS_NO_ILIAS_USER, initAttributeToUser(), 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&cmdClass=ilstartupgui');
}
$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 163 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.

Referenced by loginObserver().

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: