1212use Magento \Framework \DataObject ;
1313use Magento \Framework \Encryption \EncryptorInterface ;
1414use Magento \Framework \UrlInterface ;
15- use Magento \TwoFactorAuth \Helper \Data as TwoFactorAuthHelper ;
1615use Magento \User \Api \Data \UserInterface ;
1716use Magento \TwoFactorAuth \Api \EngineInterface ;
1817use Duo \DuoUniversal \Client ;
@@ -103,16 +102,10 @@ class DuoSecurity implements EngineInterface
103102 */
104103 private $ urlBuilder ;
105104
106- /**
107- * @var TwoFactorAuthHelper
108- */
109- private $ helper ;
110-
111105 /**
112106 * @param ScopeConfigInterface $scopeConfig
113107 * @param EncryptorInterface $encryptor
114108 * @param UrlInterface $urlBuilder
115- * @param TwoFactorAuthHelper $helper
116109 * @param Client|null $client
117110 * @param DuoAuth|null $duoAuth
118111 * @throws \Duo\DuoUniversal\DuoException
@@ -121,14 +114,12 @@ public function __construct(
121114 ScopeConfigInterface $ scopeConfig ,
122115 EncryptorInterface $ encryptor ,
123116 UrlInterface $ urlBuilder ,
124- TwoFactorAuthHelper $ helper ,
125117 Client $ client = null ,
126118 DuoAuth $ duoAuth = null
127119 ) {
128120 $ this ->scopeConfig = $ scopeConfig ;
129121 $ this ->encryptor = $ encryptor ;
130122 $ this ->urlBuilder = $ urlBuilder ;
131- $ this ->helper = $ helper ;
132123 if ($ this ->isDuoForcedProvider ()) {
133124 $ this ->client = $ client ?? new Client (
134125 $ this ->getClientId (),
@@ -221,14 +212,9 @@ private function getSkey(): string
221212 */
222213 public function verify (UserInterface $ user , DataObject $ request ): bool
223214 {
224- $ state = $ request ->getData ('state ' );
225215 $ duoCode = $ request ->getData ('duo_code ' );
226216 $ username = $ user ->getUserName ();
227217
228- if (empty ($ state ) || empty ($ username )) {
229- return false ;
230- }
231-
232218 try {
233219 // Not saving token as this is for verification purpose
234220 $ this ->client ->exchangeAuthorizationCodeFor2FAResult ($ duoCode , $ username );
@@ -289,6 +275,8 @@ public function healthCheck(): void
289275 }
290276
291277 /**
278+ * Generate a state for Duo Universal prompt
279+ *
292280 * @return string
293281 */
294282 public function generateDuoState () : string
0 commit comments