ILIAS  release_8 Revision v8.24
class.ilAuthProviderFactory.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
28{
30
34 public function __construct()
35 {
36 global $DIC;
37 $this->logger = $DIC->logger()->auth();
38 }
39
43 public function getProviders(ilAuthCredentials $credentials): array
44 {
45 // Fixed provider selection;
46 if ($credentials->getAuthMode() !== '') {
47 $this->logger->debug('Returning fixed provider for auth mode: ' . $credentials->getAuthMode());
48 return array(
49 $this->getProviderByAuthMode($credentials, $credentials->getAuthMode())
50 );
51 }
52
53 $auth_determination = ilAuthModeDetermination::_getInstance();
54 $sequence = $auth_determination->getAuthModeSequence($credentials->getUsername());
55
56 $providers = array();
57 foreach ($sequence as $position => $authmode) {
58 $provider = $this->getProviderByAuthMode($credentials, (string) $authmode);
59 if ($provider instanceof ilAuthProviderInterface) {
60 $providers[] = $provider;
61 }
62 }
63 return $providers;
64 }
65
69 public function getProviderByAuthMode(ilAuthCredentials $credentials, $a_authmode): ?ilAuthProviderInterface
70 {
71 switch ((int) $a_authmode) {
73 $ldap_info = explode('_', $a_authmode);
74 $this->logger->debug('Using ldap authentication with credentials ');
75 return new ilAuthProviderLDAP($credentials, (int) $ldap_info[1]);
76
78 $this->logger->debug('Using local database authentication');
79 return new ilAuthProviderDatabase($credentials);
80
82 $this->logger->debug('Using SOAP authentication.');
83 return new ilAuthProviderSoap($credentials);
84
86 $this->logger->debug('Using apache authentication.');
87 return new ilAuthProviderApache($credentials);
88
90 $this->logger->debug('Using CAS authentication');
91 return new ilAuthProviderCAS($credentials);
92
94 $this->logger->debug('Using shibboleth authentication.');
95 return new ilAuthProviderShibboleth($credentials);
96
98 $this->logger->debug('Using lti provider authentication.');
99 return new ilAuthProviderLTI($credentials);
100
102 $this->logger->debug('Using ecs authentication.');
103 return new ilAuthProviderECS($credentials);
104
106 $this->logger->debug('Using apache authentication.');
107 return new ilAuthProviderSaml($credentials, ilSamlIdp::getIdpIdByAuthMode($a_authmode));
108
110 $this->logger->debug('Using openid connect authentication.');
111 return new ilAuthProviderOpenIdConnect($credentials);
112
113 default:
114 $this->logger->debug('Plugin authentication: ' . $a_authmode);
115 foreach (ilAuthUtils::getAuthPlugins() as $pl) {
116 $provider = $pl->getProvider($credentials, $a_authmode);
117 if ($provider instanceof ilAuthProviderInterface) {
118 return $provider;
119 }
120 }
121 break;
122 }
123 return null;
124 }
125}
CAS authentication provider.
Auth prvider for ecs auth.
getProviderByAuthMode(ilAuthCredentials $credentials, $a_authmode)
Get provider by auth mode.
getProviders(ilAuthCredentials $credentials)
Get provider.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilAuthProviderOpenIdConnect.
Class ilAuthProviderSaml.
Shibboleth authentication provider.
Class ilAuthProviderSoap.
const AUTH_OPENID_CONNECT
static getAuthPlugins()
Get active enabled auth plugins.
Component logger with individual log levels by component id.
static getIdpIdByAuthMode(string $a_auth_mode)
global $DIC
Definition: feed.php:28
Interface of auth credentials.
getUsername()
Get username.
getAuthMode()
Get auth mode.
Standard interface for auth provider implementations.
$provider
Definition: ltitoken.php:83