ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilAuthProviderFactory.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
24
25 public function __construct()
26 {
27 global $DIC;
28 $this->logger = $DIC->logger()->auth();
29 }
30
34 public function getProviders(ilAuthCredentials $credentials): array
35 {
36 // Fixed provider selection;
37 if ($credentials->getAuthMode() !== '') {
38 $this->logger->debug('Returning fixed provider for auth mode: ' . $credentials->getAuthMode());
39 return [
40 $this->getProviderByAuthMode($credentials, $credentials->getAuthMode())
41 ];
42 }
43
44 $auth_determination = ilAuthModeDetermination::_getInstance();
45 $sequence = $auth_determination->getAuthModeSequence($credentials->getUsername());
46
47 $providers = [];
48 foreach ($sequence as $authmode) {
49 $provider = $this->getProviderByAuthMode($credentials, (string) $authmode);
50 if ($provider instanceof ilAuthProviderInterface) {
51 $providers[] = $provider;
52 }
53 }
54
55 return $providers;
56 }
57
61 public function getProviderByAuthMode(ilAuthCredentials $credentials, $a_authmode): ?ilAuthProviderInterface
62 {
63 switch ((int) $a_authmode) {
65 $ldap_info = explode('_', $a_authmode);
66 $this->logger->debug('Using ldap authentication with credentials ');
67 return new ilAuthProviderLDAP($credentials, (int) $ldap_info[1]);
68
70 $this->logger->debug('Using local database authentication');
71 return new ilAuthProviderDatabase($credentials);
72
74 $this->logger->debug('Using SOAP authentication.');
75 return new ilAuthProviderSoap($credentials);
76
78 $this->logger->debug('Using apache authentication.');
79 return new ilAuthProviderApache($credentials);
80
82 $this->logger->debug('Using shibboleth authentication.');
83 return new ilAuthProviderShibboleth($credentials);
84
86 $this->logger->debug('Using lti provider authentication.');
87 return new ilAuthProviderLTI($credentials);
88
90 $this->logger->debug('Using ecs authentication.');
91 return new ilAuthProviderECS($credentials);
92
94 $this->logger->debug('Using apache authentication.');
95 return new ilAuthProviderSaml($credentials, ilSamlIdp::getIdpIdByAuthMode($a_authmode));
96
98 $this->logger->debug('Using openid connect authentication.');
99 return new ilAuthProviderOpenIdConnect($credentials);
100
101 default:
102 $this->logger->debug('Plugin authentication: ' . $a_authmode);
103 foreach (ilAuthUtils::getAuthPlugins() as $pl) {
104 $provider = $pl->getProvider($credentials, $a_authmode);
105 if ($provider instanceof ilAuthProviderInterface) {
106 return $provider;
107 }
108 }
109 break;
110 }
111
112 return null;
113 }
114}
Auth prvider for ecs auth.
getProviderByAuthMode(ilAuthCredentials $credentials, $a_authmode)
getProviders(ilAuthCredentials $credentials)
OAuth based lti authentication.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const int AUTH_ECS
const int AUTH_SHIBBOLETH
const int AUTH_LOCAL
const int AUTH_LDAP
const int AUTH_SAML
const int AUTH_APACHE
static getAuthPlugins()
const int AUTH_SOAP
const int AUTH_OPENID_CONNECT
const int AUTH_PROVIDER_LTI
Component logger with individual log levels by component id.
static getIdpIdByAuthMode(string $a_auth_mode)
$provider
Definition: ltitoken.php:80
global $DIC
Definition: shib_login.php:26