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