ILIAS  release_7 Revision v7.30-3-g800a261c036
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 $DIC;
57
58 $ilSetting = $DIC['ilSetting'];
59 $ilDB = $DIC['ilDB'];
60
61 $this->db = $ilDB;
62
63 include_once "./Services/Administration/classes/class.ilSetting.php";
64 $this->settings = new ilSetting("auth_mode_determination");
65 $this->read();
66 }
ILIAS Setting Class.
global $DIC
Definition: goto.php:24
global $ilSetting
Definition: privfeed.php:17
settings()
Definition: settings.php:2
global $ilDB

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

+ Here is the call graph for this function:

Member Function Documentation

◆ _getInstance()

static ilAuthModeDetermination::_getInstance ( )
static

◆ getAuthModeSequence()

ilAuthModeDetermination::getAuthModeSequence (   $a_username = '')

get auth mode sequence

@access public

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

127 {
128 if (!strlen($a_username)) {
129 return $this->position ? $this->position : array();
130 }
131 $sorted = array();
132
133 foreach ($this->position as $auth_key) {
134 include_once './Services/LDAP/classes/class.ilLDAPServer.php';
135 $sid = ilLDAPServer::getServerIdByAuthMode($auth_key);
136 if ($sid) {
138 ilLoggerFactory::getLogger('auth')->debug('Validating username filter for ' . $server->getName());
139 if (strlen($server->getUsernameFilter())) {
140 //#17731
141 $pattern = str_replace('*', '.*?', $server->getUsernameFilter());
142
143 if (preg_match('/^' . $pattern . '$/', $a_username)) {
144 ilLoggerFactory::getLogger('auth')->debug('Filter matches for ' . $a_username);
145 array_unshift($sorted, $auth_key);
146 continue;
147 }
148 ilLoggerFactory::getLogger('auth')->debug('Filter matches not for ' . $a_username . ' <-> ' . $server->getUsernameFilter());
149 }
150 }
151 $sorted[] = $auth_key;
152 }
153
154 return (array) $sorted;
155 }
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, 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 163 of file class.ilAuthModeDetermination.php.

164 {
165 return count($this->position);
166 }

◆ getKind()

ilAuthModeDetermination::getKind ( )

get kind

@access public

Definition at line 103 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 92 of file class.ilAuthModeDetermination.php.

93 {
94 return $this->kind == self::TYPE_MANUAL;
95 }

References TYPE_MANUAL.

◆ read()

ilAuthModeDetermination::read ( )
private

Read settings.

@access private

Parameters

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

208 {
209 global $DIC;
210
211 $ilSetting = $DIC['ilSetting'];
212
213 $this->kind = $this->settings->get('kind', self::TYPE_MANUAL);
214
215 // begin-patch ldap_multiple
216 include_once('Services/LDAP/classes/class.ilLDAPServer.php');
217 // end-patch ldap_multiple
218
219 include_once('Services/Radius/classes/class.ilRadiusSettings.php');
220 $rad_settings = ilRadiusSettings::_getInstance();
221 $rad_active = $rad_settings->isActive();
222
223 $soap_active = $ilSetting->get('soap_auth_active', false);
224
225 // apache settings
226 $apache_settings = new ilSetting('apache_auth');
227 $apache_active = $apache_settings->get('apache_enable_auth');
228
229 // Check if active
230 // begin-patch ldap_multiple
231 $i = 0;
232 while (true) {
233 $auth_mode = $this->settings->get((string) $i++, false);
234 if ($auth_mode === false) {
235 break;
236 }
237 if ($auth_mode) {
238 // begin-patch ldap_multiple
239 switch ((int) $auth_mode) {
240 case AUTH_LOCAL:
241 $this->position[] = $auth_mode;
242 break;
243
244 case AUTH_LDAP:
245 $auth_id = ilLDAPServer::getServerIdByAuthMode($auth_mode);
247
248 if ($server->isActive()) {
249 $this->position[] = $auth_mode;
250 }
251 break;
252
253 case AUTH_RADIUS:
254 if ($rad_active) {
255 $this->position[] = $auth_mode;
256 }
257 break;
258
259 case AUTH_SOAP:
260 if ($soap_active) {
261 $this->position[] = $auth_mode;
262 }
263 break;
264
265 case AUTH_APACHE:
266 if ($apache_active) {
267 $this->position[] = $auth_mode;
268 }
269 break;
270
271 // begin-patch auth_plugin
272 default:
273 foreach (ilAuthUtils::getAuthPlugins() as $pl) {
274 if ($pl->isAuthActive($auth_mode)) {
275 $this->position[] = $auth_mode;
276 }
277 }
278 break;
279 // end-patch auth_plugin
280
281 }
282 }
283 }
284 // end-patch ldap_multiple
285
286 // Append missing active auth modes
287 if (!in_array(AUTH_LOCAL, $this->position)) {
288 $this->position[] = AUTH_LOCAL;
289 }
290 // begin-patch ldap_multiple
291 foreach (ilLDAPServer::_getActiveServerList() as $sid) {
293 if ($server->isActive()) {
294 if (!in_array(AUTH_LDAP . '_' . $sid, $this->position)) {
295 $this->position[] = (AUTH_LDAP . '_' . $sid);
296 }
297 }
298 }
299 // end-patch ldap_multiple
300 if ($rad_active) {
301 if (!in_array(AUTH_RADIUS, $this->position)) {
302 $this->position[] = AUTH_RADIUS;
303 }
304 }
305 if ($soap_active) {
306 if (!in_array(AUTH_SOAP, $this->position)) {
307 $this->position[] = AUTH_SOAP;
308 }
309 }
310 if ($apache_active) {
311 if (!in_array(AUTH_APACHE, $this->position)) {
312 $this->position[] = AUTH_APACHE;
313 }
314 }
315 // begin-patch auth_plugin
316 foreach (ilAuthUtils::getAuthPlugins() as $pl) {
317 foreach ($pl->getAuthIds() as $auth_id) {
318 if ($pl->isAuthActive($auth_id)) {
319 if (!in_array($auth_id, $this->position)) {
320 $this->position[] = $auth_id;
321 }
322 }
323 }
324 }
325 // end-patch auth_plugin
326 }
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
$i
Definition: metadata.php:24

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

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 187 of file class.ilAuthModeDetermination.php.

188 {
189 $this->settings->deleteAll();
190
191 $this->settings->set('kind', $this->getKind());
192
193 $counter = 0;
194 foreach ($this->position as $auth_mode) {
195 $this->settings->set((string) $counter++, $auth_mode);
196 }
197 }

References getKind(), and settings().

+ 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 175 of file class.ilAuthModeDetermination.php.

176 {
177 $this->position = $a_pos;
178 }

◆ setKind()

ilAuthModeDetermination::setKind (   $a_kind)

set kind of determination

@access public

Parameters
intTYPE_MANUAL or TYPE_DETERMINATION

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

116 {
117 $this->kind = $a_kind;
118 }

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: