ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilAuthContainerRadius Class Reference

Overwritten Pear class AuthContainerRadius This class is overwritten to support to perform Radius authentication with specific ILIAS options. More...

+ Inheritance diagram for ilAuthContainerRadius:
+ Collaboration diagram for ilAuthContainerRadius:

Public Member Functions

 __construct ()
 Constructor. More...
 
 forceCreation ($a_status)
 Force creation of user accounts. More...
 
 loginObserver ($a_username, $a_auth)
 Called from base class after successful login. More...
 
 supportsCaptchaVerification ()
 

Protected Member Functions

 handleLDAPDataSource ($a_auth, $ext_account)
 Handle ldap as data source. More...
 

Private Member Functions

 initSettings ()
 Init radius settings. More...
 
 initRADIUSAttributeToUser ()
 Init RADIUS attribute mapping. More...
 

Private Attributes

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

Detailed Description

Overwritten Pear class AuthContainerRadius This class is overwritten to support to perform Radius authentication with specific ILIAS options.

Author
Stefan Meyer <smeyer.de>
Version
$Id$

Definition at line 37 of file class.ilAuthContainerRadius.php.

Constructor & Destructor Documentation

◆ __construct()

ilAuthContainerRadius::__construct ( )

Constructor.

public

Parameters
arrayAn associative array of pear parameters

Definition at line 51 of file class.ilAuthContainerRadius.php.

References $GLOBALS, initSettings(), and ilRadiusSettings\RADIUS_CHARSET_LATIN1.

52  {
53  $this->initSettings();
54 
55  // Convert password to latin1
56  if($this->radius_settings->getCharset() == ilRadiusSettings::RADIUS_CHARSET_LATIN1)
57  {
58  #$_POST['username'] = utf8_decode($_POST['username']);
59  #$_POST['password'] = utf8_decode($_POST['password']);
60  $GLOBALS['ilLog']->write(__METHOD__.': Decoded username and password to latin1.');
61  }
62 
63  parent::__construct($this->radius_settings->toPearAuthArray());
64 
65  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
initSettings()
Init radius settings.
+ Here is the call graph for this function:

Member Function Documentation

◆ forceCreation()

ilAuthContainerRadius::forceCreation (   $a_status)

Force creation of user accounts.

public

Parameters
boolforce_creation

Definition at line 81 of file class.ilAuthContainerRadius.php.

82  {
83  $this->force_creation = true;
84  }

◆ handleLDAPDataSource()

ilAuthContainerRadius::handleLDAPDataSource (   $a_auth,
  $ext_account 
)
protected

Handle ldap as data source.

Parameters
Auth$auth
string$ext_account

Definition at line 167 of file class.ilAuthContainerRadius.php.

References $GLOBALS, $server, array, AUTH_RADIUS, AUTH_RADIUS_NO_ILIAS_USER, ilLDAPServer\getDataSource(), ilLDAPServer\getInstanceByServerId(), ilUtil\redirect(), and ilLDAPUserSynchronisation\setExternalAccount().

Referenced by loginObserver().

168  {
169  include_once './Services/LDAP/classes/class.ilLDAPServer.php';
172  );
173 
174  $GLOBALS['ilLog']->write(__METHOD__.'Using ldap data source');
175 
176  include_once './Services/LDAP/classes/class.ilLDAPUserSynchronisation.php';
177  $sync = new ilLDAPUserSynchronisation('radius', $server->getServerId());
178  $sync->setExternalAccount($ext_account);
179  $sync->setUserData(array());
180  $sync->forceCreation($this->force_creation);
181 
182  try {
183  $internal_account = $sync->sync();
184  }
185  catch(UnexpectedValueException $e) {
186  $GLOBALS['ilLog']->write(__METHOD__.': Login failed with message: '. $e->getMessage());
187  $a_auth->status = AUTH_WRONG_LOGIN;
188  $a_auth->logout();
189  return false;
190  }
192  // No syncronisation allowed => create Error
193  $GLOBALS['ilLog']->write(__METHOD__.': Login failed with message: '. $e->getMessage());
194  $a_auth->status = AUTH_RADIUS_NO_ILIAS_USER;
195  $a_auth->logout();
196  return false;
197  }
199  $GLOBALS['ilLog']->write(__METHOD__.': Starting account migration.');
200  $a_auth->logout();
201  ilUtil::redirect('ilias.php?baseClass=ilStartUpGUI&cmdClass=ilstartupgui&cmd=showAccountMigration');
202  }
203 
204  $a_auth->setAuth($internal_account);
205  return true;
206  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Synchronization of user accounts used in auth container ldap, radius , cas,...
const AUTH_RADIUS_NO_ILIAS_USER
setExternalAccount($a_ext)
Set external account (unique for each auth mode)
Description of ilLDAPAccountMigrationRequiredException.
static getInstanceByServerId($a_server_id)
Get instance by server id.
static getDataSource($a_auth_mode)
Create styles array
The data for the language used.
$server
static redirect($a_script)
http redirect to other script
const AUTH_RADIUS
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initRADIUSAttributeToUser()

ilAuthContainerRadius::initRADIUSAttributeToUser ( )
private

Init RADIUS attribute mapping.

private

Definition at line 156 of file class.ilAuthContainerRadius.php.

Referenced by loginObserver().

157  {
158  include_once('Services/Radius/classes/class.ilRadiusAttributeToUser.php');
159  $this->radius_user = new ilRadiusAttributeToUser();
160  }
+ Here is the caller graph for this function:

◆ initSettings()

ilAuthContainerRadius::initSettings ( )
private

Init radius settings.

Returns
void

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

References ilRadiusSettings\_getInstance().

Referenced by __construct().

144  {
145  include_once 'Services/Radius/classes/class.ilRadiusSettings.php';
146  $this->radius_settings = ilRadiusSettings::_getInstance();
147  }
static _getInstance()
singleton get instance
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loginObserver()

ilAuthContainerRadius::loginObserver (   $a_username,
  $a_auth 
)

Called from base class after successful login.

Parameters
stringusername

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

References $_POST, $_SESSION, $force_creation, ilObjUser\_checkExternalAuthAccount(), array, AUTH_RADIUS, AUTH_RADIUS_NO_ILIAS_USER, handleLDAPDataSource(), initRADIUSAttributeToUser(), ilLDAPServer\isDataSourceActive(), and ilUtil\redirect().

92  {
93  // Radius with ldap as data source
94  include_once './Services/LDAP/classes/class.ilLDAPServer.php';
96  {
97  return $this->handleLDAPDataSource($a_auth,$a_username);
98  }
99 
100  $user_data = array_change_key_case($a_auth->getAuthData(),CASE_LOWER);
101  $user_data['ilInternalAccount'] = ilObjUser::_checkExternalAuthAccount("radius",$a_username);
102 
103  if(!$user_data['ilInternalAccount'])
104  {
105  if($this->radius_settings->enabledCreation())
106  {
107  if($this->radius_settings->isAccountMigrationEnabled() and !$this->force_creation)
108  {
109  $a_auth->logout();
110  $_SESSION['tmp_auth_mode'] = 'radius';
111  $_SESSION['tmp_auth_mode_type'] = 'radius';
112  $_SESSION['tmp_external_account'] = $a_username;
113  $_SESSION['tmp_pass'] = $_POST['password'];
114  $_SESSION['tmp_roles'] = array(0 => $this->radius_settings->getDefaultRole());
115 
116  ilUtil::redirect('ilias.php?baseClass=ilStartUpGUI&cmd=showAccountMigration&cmdClass=ilstartupgui');
117  }
118  $this->initRADIUSAttributeToUser();
119  $new_name = $this->radius_user->create($a_username);
120  $a_auth->setAuth($new_name);
121  return true;
122  }
123  else
124  {
125  // No syncronisation allowed => create Error
126  $a_auth->status = AUTH_RADIUS_NO_ILIAS_USER;
127  $a_auth->logout();
128  return false;
129  }
130 
131  }
132  else
133  {
134  $a_auth->setAuth($user_data['ilInternalAccount']);
135  return true;
136  }
137  }
$_SESSION["AccountId"]
initRADIUSAttributeToUser()
Init RADIUS attribute mapping.
const AUTH_RADIUS_NO_ILIAS_USER
handleLDAPDataSource($a_auth, $ext_account)
Handle ldap as data source.
static isDataSourceActive($a_auth_mode)
Check if a data source is active for a specific auth mode ilDB $ilDB.
Create styles array
The data for the language used.
static _checkExternalAuthAccount($a_auth, $a_account)
check whether external account and authentication method matches with a user
static redirect($a_script)
http redirect to other script
$_POST["username"]
const AUTH_RADIUS
+ Here is the call graph for this function:

◆ supportsCaptchaVerification()

ilAuthContainerRadius::supportsCaptchaVerification ( )
Returns
bool

Definition at line 211 of file class.ilAuthContainerRadius.php.

212  {
213  return true;
214  }

Field Documentation

◆ $force_creation

ilAuthContainerRadius::$force_creation = false
private

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

Referenced by loginObserver().

◆ $log

ilAuthContainerRadius::$log = null
private

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

◆ $rad_to_user

ilAuthContainerRadius::$rad_to_user = null
private

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

◆ $radius_settings

ilAuthContainerRadius::$radius_settings = null
private

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


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