diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-11-17 18:42:21 +0100 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-11-17 18:42:21 +0100 |
commit | c8caba265fcb5a8c533aa726f9971b1f5b234cc9 (patch) | |
tree | c6870935dc99f933e69bb1ed48866cb22bd36971 /core/Middleware | |
parent | 0a82d2ea3aba7f9f4b25c549f5a83f40dbbb894c (diff) | |
download | nextcloud-server-c8caba265fcb5a8c533aa726f9971b1f5b234cc9.tar.gz nextcloud-server-c8caba265fcb5a8c533aa726f9971b1f5b234cc9.zip |
Explicitly allow some routes without 2FA
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'core/Middleware')
-rw-r--r-- | core/Middleware/TwoFactorMiddleware.php | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/core/Middleware/TwoFactorMiddleware.php b/core/Middleware/TwoFactorMiddleware.php index fbdb106b7bb..4c13a99a1aa 100644 --- a/core/Middleware/TwoFactorMiddleware.php +++ b/core/Middleware/TwoFactorMiddleware.php @@ -83,6 +83,12 @@ class TwoFactorMiddleware extends Middleware { * @param string $methodName */ public function beforeController($controller, $methodName) { + if ($this->reflector->hasAnnotation('NoTwoFactorRequired')) { + // Route handler explicitly marked to work without finished 2FA are + // not blocked + return; + } + if ($controller instanceof APIController && $methodName === 'poll') { // Allow polling the twofactor nextcloud notifications state return; |