ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilAuthModeDetermination Class Reference
+ Collaboration diagram for ilAuthModeDetermination:

Public Member Functions

 isManualSelection ()
 is manual selection
More...
 
 getKind ()
 get kind More...
 
 setKind ($a_kind)
 set kind of determination More...
 
 getAuthModeSequence ($a_username='')
 get auth mode sequence More...
 
 getCountActiveAuthModes ()
 get number of auth modes More...
 
 setAuthModeSequence ($a_pos)
 set auth mode sequence More...
 
 save ()
 Save settings. More...
 

Static Public Member Functions

static _getInstance ()
 Get instance. More...
 

Data Fields

const TYPE_MANUAL = 0
 
const TYPE_AUTOMATIC = 1
 

Protected Attributes

 $db = null
 
 $settings = null
 
 $kind = 0
 
 $position = array()
 

Static Protected Attributes

static $instance = null
 

Private Member Functions

 __construct ()
 Constructor (Singleton) More...
 
 read ()
 Read settings. More...
 

Detailed Description

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilAuthModeDetermination::__construct ( )
private

Constructor (Singleton)

@access private

Definition at line 54 of file class.ilAuthModeDetermination.php.

55 {
56 global $ilSetting,$ilDB;
57
58 $this->db = $ilDB;
59
60 include_once "./Services/Administration/classes/class.ilSetting.php";
61 $this->settings = new ilSetting("auth_mode_determination");
62 $this->read();
63 }
ILIAS Setting Class.
global $ilSetting
Definition: privfeed.php:40
global $ilDB

References $ilDB, $ilSetting, and read().

+ Here is the call graph for this function:

Member Function Documentation

◆ _getInstance()

static ilAuthModeDetermination::_getInstance ( )
static

Get instance.

@access public

Definition at line 72 of file class.ilAuthModeDetermination.php.

73 {
74 if(self::$instance)
75 {
76 return self::$instance;
77 }
78 return self::$instance = new ilAuthModeDetermination();
79 }

References $instance.

Referenced by ilAuthUtils\_getAuthModeOfUser(), ilAuthContainerMultiple\fetchData(), ilObjAuthSettingsGUI\initAuthModeDetermination(), ilStartUpGUI\showLoginForm(), and ilObjAuthSettingsGUI\updateAuthModeDeterminationObject().

+ Here is the caller graph for this function:

◆ getAuthModeSequence()

ilAuthModeDetermination::getAuthModeSequence (   $a_username = '')

get auth mode sequence

@access public

Definition at line 123 of file class.ilAuthModeDetermination.php.

124 {
125 if(!strlen($a_username))
126 {
127 return $this->position ? $this->position : array();
128 }
129 $sorted = array();
130
131 ilLoggerFactory::getLogger('auth')->dump($this->position, ilLogLevel::DEBUG);
132
133 foreach($this->position as $auth_key)
134 {
135 include_once './Services/LDAP/classes/class.ilLDAPServer.php';
136 $sid = ilLDAPServer::getServerIdByAuthMode($auth_key);
137 if($sid)
138 {
140 ilLoggerFactory::getLogger('auth')->debug('Validating username filter for ' . $server->getName());
141 if(strlen($server->getUsernameFilter()))
142 {
143 //#17731
144 $pattern = str_replace('*','.*?', $server->getUsernameFilter());
145
146 if(preg_match('/^'.$pattern.'$/', $a_username))
147 {
148 ilLoggerFactory::getLogger('auth')->debug('Filter matches for ' . $a_username);
149 array_unshift($sorted, $auth_key);
150 continue;
151 }
152 ilLoggerFactory::getLogger('auth')->debug('Filter matches not for ' . $a_username. ' <-> ' . $server->getUsernameFilter());
153 }
154 }
155 $sorted[] = $auth_key;
156 }
157
158 ilLoggerFactory::getLogger('auth')->dump($this->position, ilLogLevel::DEBUG);
159
160 return (array) $sorted;
161 }
static getServerIdByAuthMode($a_auth_mode)
Get auth id by auth mode.
static getInstanceByServerId($a_server_id)
Get instance by server id.
static getLogger($a_component_id)
Get component logger.
$server

References $server, ilLogLevel\DEBUG, ilLDAPServer\getInstanceByServerId(), ilLoggerFactory\getLogger(), and ilLDAPServer\getServerIdByAuthMode().

+ Here is the call graph for this function:

◆ getCountActiveAuthModes()

ilAuthModeDetermination::getCountActiveAuthModes ( )

get number of auth modes

@access public

Definition at line 169 of file class.ilAuthModeDetermination.php.

170 {
171 return count($this->position);
172 }

◆ getKind()

ilAuthModeDetermination::getKind ( )

get kind

@access public

Definition at line 100 of file class.ilAuthModeDetermination.php.

References $kind.

Referenced by save().

+ Here is the caller graph for this function:

◆ isManualSelection()

ilAuthModeDetermination::isManualSelection ( )

is manual selection

@access public

Parameters

Definition at line 89 of file class.ilAuthModeDetermination.php.

90 {
91 return $this->kind == self::TYPE_MANUAL;
92 }

References TYPE_MANUAL.

◆ read()

ilAuthModeDetermination::read ( )
private

Read settings.

@access private

Parameters

Definition at line 214 of file class.ilAuthModeDetermination.php.

215 {
216 global $ilSetting;
217
218 $this->kind = $this->settings->get('kind',self::TYPE_MANUAL);
219
220 // begin-patch ldap_multiple
221 include_once('Services/LDAP/classes/class.ilLDAPServer.php');
222 // end-patch ldap_multiple
223
224 include_once('Services/Radius/classes/class.ilRadiusSettings.php');
225 $rad_settings = ilRadiusSettings::_getInstance();
226 $rad_active = $rad_settings->isActive();
227
228 $soap_active = $ilSetting->get('soap_auth_active',false);
229
230 // apache settings
231 $apache_settings = new ilSetting('apache_auth');
232 $apache_active = $apache_settings->get('apache_enable_auth');
233
234 // Check if active
235 // begin-patch ldap_multiple
236 $i = 0;
237 while(true)
238 {
239 $auth_mode = $this->settings->get((string) $i++,FALSE);
240 if($auth_mode === FALSE)
241 {
242 break;
243 }
244 if($auth_mode)
245 {
246 // begin-patch ldap_multiple
247 switch((int) $auth_mode)
248 {
249 case AUTH_LOCAL:
250 $this->position[] = $auth_mode;
251 break;
252
253 case AUTH_LDAP:
254 $auth_id = ilLDAPServer::getServerIdByAuthMode($auth_mode);
256
257 if($server->isActive())
258 {
259 $this->position[] = $auth_mode;
260 }
261 break;
262
263 case AUTH_RADIUS:
264 if($rad_active)
265 {
266 $this->position[] = $auth_mode;
267 }
268 break;
269
270 case AUTH_SOAP:
271 if($soap_active)
272 {
273 $this->position[] = $auth_mode;
274 }
275 break;
276
277 case AUTH_APACHE:
278 if($apache_active)
279 {
280 $this->position[] = $auth_mode;
281 }
282 break;
283
284 // begin-patch auth_plugin
285 default:
286 foreach(ilAuthUtils::getAuthPlugins() as $pl)
287 {
288 if($pl->isAuthActive($auth_mode))
289 {
290 $this->position[] = $auth_mode;
291 }
292 }
293 break;
294 // end-patch auth_plugin
295
296 }
297 }
298 }
299 // end-patch ldap_multiple
300
301 // Append missing active auth modes
302 if(!in_array(AUTH_LOCAL,$this->position))
303 {
304 $this->position[] = AUTH_LOCAL;
305 }
306 // begin-patch ldap_multiple
307 foreach(ilLDAPServer::_getActiveServerList() as $sid)
308 {
310 if($server->isActive())
311 {
312 if(!in_array(AUTH_LDAP.'_'.$sid, $this->position))
313 {
314 $this->position[] = (AUTH_LDAP.'_'.$sid);
315 }
316 }
317
318 }
319 // end-patch ldap_multiple
320 if($rad_active)
321 {
322 if(!in_array(AUTH_RADIUS,$this->position))
323 {
324 $this->position[] = AUTH_RADIUS;
325 }
326
327 }
328 if($soap_active)
329 {
330 if(!in_array(AUTH_SOAP,$this->position))
331 {
332 $this->position[] = AUTH_SOAP;
333 }
334 }
335 if($apache_active)
336 {
337 if(!in_array(AUTH_APACHE,$this->position))
338 {
339 $this->position[] = AUTH_APACHE;
340 }
341 }
342 // begin-patch auth_plugin
343 foreach(ilAuthUtils::getAuthPlugins() as $pl)
344 {
345 foreach($pl->getAuthIds() as $auth_id)
346 {
347 if($pl->isAuthActive($auth_id))
348 {
349 if(!in_array($auth_id, $this->position))
350 {
351 $this->position[] = $auth_id;
352 }
353 }
354 }
355 }
356 // end-patch auth_plugin
357 }
const AUTH_APACHE
const AUTH_LDAP
const AUTH_LOCAL
const AUTH_RADIUS
const AUTH_SOAP
static getAuthPlugins()
Get active enabled auth plugins.
static _getActiveServerList()
Get active server list.
static _getInstance()
singleton get instance

References $ilSetting, $server, ilLDAPServer\_getActiveServerList(), ilRadiusSettings\_getInstance(), AUTH_APACHE, AUTH_LDAP, AUTH_LOCAL, AUTH_RADIUS, AUTH_SOAP, ilAuthUtils\getAuthPlugins(), ilLDAPServer\getInstanceByServerId(), and ilLDAPServer\getServerIdByAuthMode().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilAuthModeDetermination::save ( )

Save settings.

@access public

Parameters

Definition at line 193 of file class.ilAuthModeDetermination.php.

194 {
195 $this->settings->deleteAll();
196
197 $this->settings->set('kind',$this->getKind());
198
199 $counter = 0;
200 foreach($this->position as $auth_mode)
201 {
202 $this->settings->set((string) $counter++,$auth_mode);
203 }
204 }

References getKind().

+ Here is the call graph for this function:

◆ setAuthModeSequence()

ilAuthModeDetermination::setAuthModeSequence (   $a_pos)

set auth mode sequence

@access public

Parameters
arrayposition => AUTH_MODE

Definition at line 181 of file class.ilAuthModeDetermination.php.

182 {
183 $this->position = $a_pos;
184 }

◆ setKind()

ilAuthModeDetermination::setKind (   $a_kind)

set kind of determination

@access public

Parameters
intTYPE_MANUAL or TYPE_DETERMINATION

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

113 {
114 $this->kind = $a_kind;
115 }

Field Documentation

◆ $db

ilAuthModeDetermination::$db = null
protected

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

◆ $instance

ilAuthModeDetermination::$instance = null
staticprotected

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

Referenced by _getInstance().

◆ $kind

ilAuthModeDetermination::$kind = 0
protected

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

Referenced by getKind().

◆ $position

ilAuthModeDetermination::$position = array()
protected

Definition at line 45 of file class.ilAuthModeDetermination.php.

◆ $settings

ilAuthModeDetermination::$settings = null
protected

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

◆ TYPE_AUTOMATIC

const ilAuthModeDetermination::TYPE_AUTOMATIC = 1

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

◆ TYPE_MANUAL

const ilAuthModeDetermination::TYPE_MANUAL = 0

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

Referenced by isManualSelection().


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