Explicitly allow some routes without 2FA

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
pull/29765/head
Christoph Wurst 3 years ago committed by Arthur Schiwon
parent 183a03830d
commit abfab44663
No known key found for this signature in database
GPG Key ID: 7424F1874854DF23

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

@ -84,6 +84,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