force 2fa for group of users (#456)

Authored-by: Antonio Cordeddu <coranto@yetopen.com>
This commit is contained in:
Antonio Cordeddu
2022-08-10 09:22:35 +02:00
committed by GitHub
parent 43b2d76ec6
commit a0ad86d53d
39 changed files with 409 additions and 50 deletions

View File

@ -12,4 +12,4 @@ if (file_exists(__DIR__.'/db.local.php')) {
$db = array_merge($db, require(__DIR__.'/db.local.php'));
}
return $db;
return $db;

View File

@ -1,5 +1,7 @@
<?php
use Da\User\Filter\TwoFactorAuthenticationEnforceFilter;
return [
'id' => 'yii2-user-tests',
'basePath' => dirname(__DIR__),
@ -47,4 +49,12 @@ return [
],
],
'params' => [],
'on beforeAction' => function() {
Yii::$app->controller->attachBehavior(
'enforceTwoFactorAuthentication',[
'class' => TwoFactorAuthenticationEnforceFilter::class,
'except' => ['login', 'logout','account','two-factor', 'two-factor-enable'],
]
);
},
];