ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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  $this->getLogger()->debug('Returning fixed provider for auth mode: ' . $credentials->getAuthMode());
42  return array(
43  $this->getProviderByAuthMode($credentials, $credentials->getAuthMode())
44  );
45  }
46 
47  include_once './Services/Authentication/classes/class.ilAuthModeDetermination.php';
48  $auth_determination = ilAuthModeDetermination::_getInstance();
49  $sequence = $auth_determination->getAuthModeSequence($credentials->getUsername());
50 
51  $providers = array();
52  foreach ((array) $sequence as $position => $authmode) {
53  $provider = $this->getProviderByAuthMode($credentials, $authmode);
54  if ($provider instanceof ilAuthProviderInterface) {
55  $providers[] = $provider;
56  }
57  }
58  return $providers;
59  }
60 
65  public function getProviderByAuthMode(ilAuthCredentials $credentials, $a_authmode)
66  {
67  switch ((int) $a_authmode) {
68  case AUTH_LDAP:
69  $ldap_info = explode('_', $a_authmode);
70  $this->getLogger()->debug('Using ldap authentication with credentials ');
71  include_once './Services/LDAP/classes/class.ilAuthProviderLDAP.php';
72  return new ilAuthProviderLDAP($credentials, $ldap_info[1]);
73 
74  case AUTH_LOCAL:
75  $this->getLogger()->debug('Using local database authentication');
76  include_once './Services/Authentication/classes/Provider/class.ilAuthProviderDatabase.php';
77  return new ilAuthProviderDatabase($credentials);
78 
79  case AUTH_APACHE:
80  $this->getLogger()->debug('Using apache authentication.');
81  include_once './Services/AuthApache/classes/class.ilAuthProviderApache.php';
82  return new ilAuthProviderApache($credentials);
83 
84  case AUTH_CAS:
85  $this->getLogger()->debug('Using CAS authentication');
86  include_once './Services/CAS/classes/class.ilAuthProviderCAS.php';
87  return new ilAuthProviderCAS($credentials);
88 
89  case AUTH_RADIUS:
90  $this->getLogger()->debug('Using radius authentication.');
91  include_once './Services/Radius/classes/class.ilAuthProviderRadius.php';
92  return new ilAuthProviderRadius($credentials);
93 
94  case AUTH_SHIBBOLETH:
95  $this->getLogger()->debug('Using shibboleth authentication.');
96  include_once './Services/AuthShibboleth/classes/class.ilAuthProviderShibboleth.php';
97  return new ilAuthProviderShibboleth($credentials);
98 
99  case AUTH_LTI_PROVIDER:
100  $this->getLogger()->debug('Using lti provider authentication.');
101  include_once './Services/LTI/classes/InternalProvider/class.ilAuthProviderLTI.php';
102  return new ilAuthProviderLTI($credentials);
103 
104  case AUTH_ECS:
105  $this->getLogger()->debug('Using ecs authentication.');
106  include_once './Services/WebServices/ECS/classes/class.ilAuthProviderECS.php';
107  return new ilAuthProviderECS($credentials);
108 
109  case AUTH_SAML:
110  $this->getLogger()->debug('Using apache authentication.');
111  require_once 'Services/Saml/classes/class.ilAuthProviderSaml.php';
112  require_once 'Services/Saml/classes/class.ilSamlIdp.php';
113  return new ilAuthProviderSaml($credentials, ilSamlIdp::getIdpIdByAuthMode($a_authmode));
114 
115  default:
116  $this->getLogger('Plugin authentication: ' . $a_authmode);
117  foreach (ilAuthUtils::getAuthPlugins() as $pl) {
118  $provider = $pl->getProvider($credentials, $a_authmode);
119  if ($provider instanceof ilAuthProviderInterface) {
120  return $provider;
121  }
122  }
123  break;
124  }
125  return null;
126  }
127 }
static getIdpIdByAuthMode($a_auth_mode)
getProviders(ilAuthCredentials $credentials)
Get provider.
Interface of auth credentials.
CAS authentication provider.
const AUTH_LDAP
Description of class class.
const AUTH_CAS
const AUTH_SHIBBOLETH
const AUTH_APACHE
getUsername()
Get username.
const AUTH_SAML
Description of class class.
Description of class class.
static getAuthPlugins()
Get active enabled auth plugins.
Standard interface for auth provider implementations.
Auth prvider for ecs auth.
const AUTH_ECS
const AUTH_LOCAL
Create styles array
The data for the language used.
OAuth based lti authentication.
Class ilAuthProviderSaml.
Shibboleth authentication provider.
getAuthMode()
Get auth mode.
static getLogger($a_component_id)
Get component logger.
getProviderByAuthMode(ilAuthCredentials $credentials, $a_authmode)
Get provider by auth mode.
const AUTH_RADIUS