Browse Source

Explicitly allow some routes without 2FA

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
pull/29752/head
Christoph Wurst 4 years ago
parent
commit
c8caba265f
No known key found for this signature in database GPG Key ID: CC42AC2A7F0E56D8
  1. 1
      core/Controller/OCJSController.php
  2. 6
      core/Middleware/TwoFactorMiddleware.php

1
core/Controller/OCJSController.php

@ -98,6 +98,7 @@ class OCJSController extends Controller {
/**
* @NoCSRFRequired
* @NoTwoFactorRequired
* @PublicPage
*
* @return DataDisplayResponse

6
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;

Loading…
Cancel
Save