summaryrefslogtreecommitdiffstats
path: root/lib/private/Authentication
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2018-08-08 15:25:59 +0200
committerChristoph Wurst <christoph@winzerhof-wurst.at>2018-08-08 15:25:59 +0200
commitc6e47e8a5139cccdd51a6c68e112e28b73adaddd (patch)
treedf14c63255cdc6e0d379aaa1899dfc991534c796 /lib/private/Authentication
parent6b1ba9cdaf3ce5d63e6e46bcbc677cf7933f5fb3 (diff)
downloadnextcloud-server-c6e47e8a5139cccdd51a6c68e112e28b73adaddd.tar.gz
nextcloud-server-c6e47e8a5139cccdd51a6c68e112e28b73adaddd.zip
Fix login redirection if only one 2FA provider is active
Fixes https://github.com/nextcloud/server/issues/10500. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/private/Authentication')
-rw-r--r--lib/private/Authentication/TwoFactorAuth/ProviderSet.php11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/private/Authentication/TwoFactorAuth/ProviderSet.php b/lib/private/Authentication/TwoFactorAuth/ProviderSet.php
index bbb9467798b..63012d9ab55 100644
--- a/lib/private/Authentication/TwoFactorAuth/ProviderSet.php
+++ b/lib/private/Authentication/TwoFactorAuth/ProviderSet.php
@@ -25,6 +25,8 @@ declare(strict_types=1);
namespace OC\Authentication\TwoFactorAuth;
+use function array_filter;
+use OCA\TwoFactorBackupCodes\Provider\BackupCodesProvider;
use OCP\Authentication\TwoFactorAuth\IProvider;
/**
@@ -65,6 +67,15 @@ class ProviderSet {
return $this->providers;
}
+ /**
+ * @return IProvider[]
+ */
+ public function get3rdPartyProviders(): array {
+ return array_filter($this->providers, function(IProvider $provider) {
+ return !($provider instanceof BackupCodesProvider);
+ });
+ }
+
public function isProviderMissing(): bool {
return $this->providerMissing;
}