diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2021-04-16 14:52:59 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2021-04-20 21:01:16 +0200 |
commit | 5ee9e1f78467d1004177012978160731606f204e (patch) | |
tree | 19d94834311518bb7cad1e2669f7bb64d5225d39 /lib/private/Authentication/TwoFactorAuth | |
parent | 46872e392183215a2bcac2e7e80937ae58e4b4ab (diff) | |
download | nextcloud-server-5ee9e1f78467d1004177012978160731606f204e.tar.gz nextcloud-server-5ee9e1f78467d1004177012978160731606f204e.zip |
Move 2FA registration to IBootstrap
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/private/Authentication/TwoFactorAuth')
-rw-r--r-- | lib/private/Authentication/TwoFactorAuth/ProviderLoader.php | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/private/Authentication/TwoFactorAuth/ProviderLoader.php b/lib/private/Authentication/TwoFactorAuth/ProviderLoader.php index 40385d737ae..57b9413feb4 100644 --- a/lib/private/Authentication/TwoFactorAuth/ProviderLoader.php +++ b/lib/private/Authentication/TwoFactorAuth/ProviderLoader.php @@ -40,8 +40,12 @@ class ProviderLoader { /** @var IAppManager */ private $appManager; - public function __construct(IAppManager $appManager) { + /** @var OC\AppFramework\Bootstrap\Coordinator */ + private $coordinator; + + public function __construct(IAppManager $appManager, OC\AppFramework\Bootstrap\Coordinator $coordinator) { $this->appManager = $appManager; + $this->coordinator = $coordinator; } /** @@ -72,6 +76,18 @@ class ProviderLoader { } } + $registeredProviders = $this->coordinator->getRegistrationContext()->getTwoFactorProvider(); + foreach ($registeredProviders as $provider) { + try { + $this->loadTwoFactorApp($provider->getAppId()); + $provider = OC::$server->query($provider->getService()); + $providers[$provider->getId()] = $provider; + } catch (QueryException $exc) { + // Provider class can not be resolved + throw new Exception('Could not load two-factor auth provider ' . $provider->getService()); + } + } + return $providers; } |