File tree Expand file tree Collapse file tree 2 files changed +17
-13
lines changed Expand file tree Collapse file tree 2 files changed +17
-13
lines changed Original file line number Diff line number Diff line change 6
6
7
7
declare (strict_types=1 );
8
8
9
- namespace Magento \TwoFactorAuth \TestFramework ;
9
+ namespace Magento \TwoFactorAuth \TestFramework \ Plugin ;
10
10
11
+ use Closure ;
11
12
use Magento \Backend \App \AbstractAction ;
12
13
use Magento \Framework \Event \Observer ;
13
- use Magento \TwoFactorAuth \Observer \ControllerActionPredispatch as ParentObserver ;
14
+ use Magento \TestFramework \Request ;
15
+ use Magento \TwoFactorAuth \Observer \ControllerActionPredispatch ;
14
16
15
17
/**
16
- * Observer that allows integration controller tests that are not aware of 2FA to run.
18
+ * Plugin that allows integration controller tests that are not aware of 2FA to run.
17
19
*/
18
- class ControllerActionPredispatch extends ParentObserver
20
+ class BypassTwoFactorAuth
19
21
{
20
- /**
21
- * @inheritDoc
22
- */
23
- public function execute ( Observer $ observer)
24
- {
22
+ public function aroundExecute (
23
+ ControllerActionPredispatch $ subject ,
24
+ Closure $ proceed ,
25
+ Observer $ observer
26
+ ) : void {
25
27
/** @var $controllerAction AbstractAction */
26
28
$ controllerAction = $ observer ->getEvent ()->getData ('controller_action ' );
27
29
if (method_exists ($ controllerAction , 'getRequest ' )
28
- && $ controllerAction ->getRequest () instanceof \ Magento \ TestFramework \ Request
30
+ && $ controllerAction ->getRequest () instanceof Request
29
31
&& !$ controllerAction ->getRequest ()->getParam ('tfa_enabled ' )
30
32
) {
31
33
//Hack that allows integration controller tests that are not aware of 2FA to run
32
34
return ;
33
35
}
34
36
35
- parent :: execute ($ observer );
37
+ $ proceed ($ observer );
36
38
}
37
39
}
Original file line number Diff line number Diff line change 40
40
<preference for =" Magento\TwoFactorAuth\Api\DuoAuthenticateInterface" type =" Magento\TwoFactorAuth\Model\Provider\Engine\DuoSecurity\Authenticate" />
41
41
<preference for =" Magento\TwoFactorAuth\Api\Data\DuoDataInterface" type =" Magento\TwoFactorAuth\Model\Data\Provider\Engine\DuoSecurity\Data" />
42
42
<preference for =" Magento\TwoFactorAuth\Api\U2fKeyConfigReaderInterface" type =" Magento\TwoFactorAuth\Model\Provider\Engine\U2fKey\ConfigReader" />
43
- <preference for =" OTPHP\TOTPInterface" type =" OTPHP\TOTP" />
44
43
45
44
<type name =" Magento\Framework\Console\CommandListInterface" >
46
45
<arguments >
87
86
<plugin name =" fixDefaultUrl" type =" Magento\TwoFactorAuth\Plugin\FirstAvailableMenu" />
88
87
</type >
89
88
89
+ <type name =" Magento\TwoFactorAuth\Observer\ControllerActionPredispatch" >
90
+ <plugin name =" bypass_twofactorauth_testframework" type =" Magento\TwoFactorAuth\TestFramework\Plugin\BypassTwoFactorAuth" />
91
+ </type >
92
+
90
93
<virtualType name =" Magento\TwoFactorAuth\Model\Provider\Google" type =" Magento\TwoFactorAuth\Model\Provider" >
91
94
<arguments >
92
95
<argument name =" engine" xsi : type =" object" >Magento\TwoFactorAuth\Model\Provider\Engine\Google</argument >
159
162
<preference for =" Magento\TwoFactorAuth\Api\UserConfigRequestManagerInterface" type =" Magento\TwoFactorAuth\Model\UserConfig\UserConfigRequestManager" />
160
163
<preference for =" Magento\TwoFactorAuth\Api\UserConfigTokenManagerInterface" type =" Magento\TwoFactorAuth\Model\UserConfig\SignedTokenManager" />
161
164
<preference for =" Magento\TwoFactorAuth\Api\UserNotifierInterface" type =" Magento\TwoFactorAuth\Model\EmailUserNotifier" />
162
- <preference for =" Magento\TwoFactorAuth\Observer\ControllerActionPredispatch" type =" Magento\TwoFactorAuth\TestFramework\ControllerActionPredispatch" />
163
165
</config >
You can’t perform that action at this time.
0 commit comments