51e1433662277ef3107d6fe0b347b54ac1c938db
[GitHub/WoltLab/WCF.git] /
1 <?php
2
3 namespace wcf\system\user\authentication\configuration;
4
5 use wcf\system\appmaker\app\preset\event\ConfigurationLoading;
6 use wcf\system\event\EventHandler;
7 use wcf\system\SingletonFactory;
8
9 /**
10 * Provides the instance of the active configuration of the user authentication process.
11 *
12 * @author Marcel Werk
13 * @copyright 2001-2023 WoltLab GmbH
14 * @license WoltLab License <http://www.woltlab.com/license-agreement.html>
15 */
16 final class UserAuthenticationConfigurationFactory extends SingletonFactory
17 {
18 private UserAuthenticationConfiguration $configuration;
19
20 #[\Override]
21 protected function init()
22 {
23 $this->configuration = $this->getDefaultConfiguration();
24
25 $event = new ConfigurationLoading();
26 EventHandler::getInstance()->fire($event);
27 if ($event->getConfigration()) {
28 $this->configuration = $event->getConfigration();
29 }
30 }
31
32 public function getConfigration(): UserAuthenticationConfiguration
33 {
34 return $this->configuration;
35 }
36
37 private function getDefaultConfiguration(): UserAuthenticationConfiguration
38 {
39 return new UserAuthenticationConfiguration(
40 !\REGISTER_DISABLED,
41 );
42 }
43 }