File tree Expand file tree Collapse file tree 3 files changed +8
-18
lines changed
Test/Unit/Model/Provider/Engine Expand file tree Collapse file tree 3 files changed +8
-18
lines changed Original file line number Diff line number Diff line change @@ -78,20 +78,20 @@ class DuoSecurity implements EngineInterface
78
78
private $ scopeConfig ;
79
79
80
80
/**
81
- * @var bool
81
+ * @var string
82
82
*/
83
- private $ forceUseDuoAuth ;
83
+ private $ duoSignaturePrefix ;
84
84
85
85
/**
86
86
* @param ScopeConfigInterface $scopeConfig
87
- * @param bool $forceUseDuoAuth
87
+ * @param string $duoSignaturePrefix
88
88
*/
89
89
public function __construct (
90
90
ScopeConfigInterface $ scopeConfig ,
91
- bool $ forceUseDuoAuth = false
91
+ string $ duoSignaturePrefix = self :: AUTH_PREFIX
92
92
) {
93
93
$ this ->scopeConfig = $ scopeConfig ;
94
- $ this ->forceUseDuoAuth = $ forceUseDuoAuth ;
94
+ $ this ->duoSignaturePrefix = $ duoSignaturePrefix ;
95
95
}
96
96
97
97
/**
@@ -216,7 +216,7 @@ public function getRequestSignature(UserInterface $user): string
216
216
$ duoSignature = $ this ->signValues (
217
217
$ this ->getSecretKey (),
218
218
$ values ,
219
- $ this ->getPrefix () ,
219
+ $ this ->duoSignaturePrefix ,
220
220
static ::DUO_EXPIRE ,
221
221
$ time
222
222
);
@@ -231,16 +231,6 @@ public function getRequestSignature(UserInterface $user): string
231
231
return $ duoSignature . ': ' . $ appSignature ;
232
232
}
233
233
234
- /**
235
- * Return prefix to use in the signature
236
- *
237
- * @return string
238
- */
239
- private function getPrefix () : string
240
- {
241
- return ($ this ->forceUseDuoAuth ) ? static ::DUO_PREFIX : static ::AUTH_PREFIX ;
242
- }
243
-
244
234
/**
245
235
* @inheritDoc
246
236
*/
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ protected function setUp(): void
47
47
$ this ->user = $ this ->getMockBuilder (UserInterface::class)->disableOriginalConstructor ()->getMock ();
48
48
49
49
$ this ->model = $ objectManager ->getObject (DuoSecurity::class, ['scopeConfig ' => $ this ->configMock ]);
50
- $ this ->modelWithForcedDuoAuth = new DuoSecurity ($ this ->configMock , true );
50
+ $ this ->modelWithForcedDuoAuth = new DuoSecurity ($ this ->configMock , $ this -> model :: DUO_PREFIX );
51
51
}
52
52
53
53
/**
Original file line number Diff line number Diff line change 23
23
</type >
24
24
<type name =" Magento\TwoFactorAuth\Model\Provider\Engine\DuoSecurity" >
25
25
<arguments >
26
- <argument name =" forceUseDuoAuth " xsi : type =" boolean " >true </argument >
26
+ <argument name =" duoSignaturePrefix " xsi : type =" const " >Magento\TwoFactorAuth\Model\Provider\Engine\DuoSecurity::DUO_PREFIX </argument >
27
27
</arguments >
28
28
</type >
29
29
</config >
You can’t perform that action at this time.
0 commit comments