ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
class.ilAuthProviderFactory.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24{
26
27 public function __construct()
28 {
29 global $DIC;
30 $this->logger = $DIC->logger()->auth();
31 }
32
36 public function getProviders(ilAuthCredentials $credentials): array
37 {
38 // Fixed provider selection;
39 if ($credentials->getAuthMode() !== '') {
40 $this->logger->debug('Returning fixed provider for auth mode: ' . $credentials->getAuthMode());
41 return [
42 $this->getProviderByAuthMode($credentials, $credentials->getAuthMode())
43 ];
44 }
45
46 $auth_determination = ilAuthModeDetermination::_getInstance();
47 $sequence = $auth_determination->getAuthModeSequence($credentials->getUsername());
48
49 $providers = [];
50 foreach ($sequence as $authmode) {
51 $provider = $this->getProviderByAuthMode($credentials, (string) $authmode);
52 if ($provider instanceof ilAuthProviderInterface) {
53 $providers[] = $provider;
54 }
55 }
56
57 return $providers;
58 }
59
63 public function getProviderByAuthMode(ilAuthCredentials $credentials, $a_authmode): ?ilAuthProviderInterface
64 {
65 switch ((int) $a_authmode) {
67 $ldap_info = explode('_', $a_authmode);
68 $this->logger->debug('Using ldap authentication with credentials ');
69 return new ilAuthProviderLDAP($credentials, (int) $ldap_info[1]);
70
72 $this->logger->debug('Using local database authentication');
73 return new ilAuthProviderDatabase($credentials);
74
76 $this->logger->debug('Using SOAP authentication.');
77 return new ilAuthProviderSoap($credentials);
78
80 $this->logger->debug('Using apache authentication.');
81 return new AuthProviderApache($credentials);
82
84 $this->logger->debug('Using shibboleth authentication.');
85 return new ilAuthProviderShibboleth($credentials);
86
88 $this->logger->debug('Using lti provider authentication.');
89 return new ilAuthProviderLTI($credentials);
90
92 $this->logger->debug('Using ecs authentication.');
93 return new ilAuthProviderECS($credentials);
94
96 $this->logger->debug('Using apache authentication.');
97 return new ilAuthProviderSaml($credentials, ilSamlIdp::getIdpIdByAuthMode($a_authmode));
98
100 $this->logger->debug('Using openid connect authentication.');
101 return new ilAuthProviderOpenIdConnect($credentials);
102
103 default:
104 $this->logger->debug('Plugin authentication: ' . $a_authmode);
105 foreach (ilAuthUtils::getAuthPlugins() as $pl) {
106 $provider = $pl->getProvider($credentials, $a_authmode);
107 if ($provider instanceof ilAuthProviderInterface) {
108 return $provider;
109 }
110 }
111 break;
112 }
113
114 return null;
115 }
116}
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