ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilAuthProviderFactory.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4
12{
13 private $logger = null;
14
15
19 public function __construct()
20 {
21 $this->logger = ilLoggerFactory::getLogger('auth');
22 }
23
28 public function getLogger()
29 {
30 return $this->logger;
31 }
32
37 public function getProviders(ilAuthCredentials $credentials)
38 {
39 // Fixed provider selection;
40 if(strlen($credentials->getAuthMode()))
41 {
42 $this->getLogger()->debug('Returning fixed provider for auth mode: ' . $credentials->getAuthMode());
43 return array(
44 $this->getProviderByAuthMode($credentials, $credentials->getAuthMode())
45 );
46 }
47
48 include_once './Services/Authentication/classes/class.ilAuthModeDetermination.php';
49 $auth_determination = ilAuthModeDetermination::_getInstance();
50 $sequence = $auth_determination->getAuthModeSequence($credentials->getUsername());
51
52 $providers = array();
53 foreach((array) $sequence as $position => $authmode)
54 {
55 $provider = $this->getProviderByAuthMode($credentials, $authmode);
57 {
58 $providers[] = $provider;
59 }
60 }
61 return $providers;
62 }
63
68 public function getProviderByAuthMode(ilAuthCredentials $credentials, $a_authmode)
69 {
70 switch((int) $a_authmode)
71 {
72 case AUTH_LDAP:
73 $ldap_info = explode('_', $a_authmode);
74 $this->getLogger()->debug('Using ldap authentication with credentials ');
75 include_once './Services/LDAP/classes/class.ilAuthProviderLDAP.php';
76 return new ilAuthProviderLDAP($credentials, $ldap_info[1]);
77
78 case AUTH_LOCAL:
79 $this->getLogger()->debug('Using local database authentication');
80 include_once './Services/Authentication/classes/Provider/class.ilAuthProviderDatabase.php';
81 return new ilAuthProviderDatabase($credentials);
82
83 case AUTH_APACHE:
84 $this->getLogger()->debug('Using apache authentication.');
85 include_once './Services/AuthApache/classes/class.ilAuthProviderApache.php';
86 return new ilAuthProviderApache($credentials);
87
88 case AUTH_CAS:
89 $this->getLogger()->debug('Using CAS authentication');
90 include_once './Services/CAS/classes/class.ilAuthProviderCAS.php';
91 return new ilAuthProviderCAS($credentials);
92
93 case AUTH_RADIUS:
94 $this->getLogger()->debug('Using radius authentication.');
95 include_once './Services/Radius/classes/class.ilAuthProviderRadius.php';
96 return new ilAuthProviderRadius($credentials);
97
98 case AUTH_SHIBBOLETH:
99 $this->getLogger()->debug('Using shibboleth authentication.');
100 include_once './Services/AuthShibboleth/classes/class.ilAuthProviderShibboleth.php';
101 return new ilAuthProviderShibboleth($credentials);
102
103 case AUTH_ECS:
104 $this->getLogger()->debug('Using ecs authentication.');
105 include_once './Services/WebServices/ECS/classes/class.ilAuthProviderECS.php';
106 return new ilAuthProviderECS($credentials);
107
108 }
109 return null;
110 }
111
112}
113?>
An exception for terminatinating execution or to throw for unit testing.
const AUTH_SHIBBOLETH
const AUTH_APACHE
const AUTH_ECS
const AUTH_LDAP
const AUTH_LOCAL
const AUTH_RADIUS
const AUTH_CAS
CAS authentication provider.
Description of class class.
Auth prvider for ecs auth.
getProviderByAuthMode(ilAuthCredentials $credentials, $a_authmode)
Get provider by auth mode.
getProviders(ilAuthCredentials $credentials)
Get provider.
Description of class class.
Description of class class.
Shibboleth authentication provider.
static getLogger($a_component_id)
Get component logger.
Interface of auth credentials.
getUsername()
Get username.
getAuthMode()
Get auth mode.
Standard interface for auth provider implementations.